wine: fix musl build.

They started using the undocumented and glibc specific ns_name_skip
function, so vendor that function in as a static function; it's luckily
simple enough.
This commit is contained in:
Érico Nogueira 2021-04-13 02:06:49 -03:00
parent 94eb7c4a2f
commit 85665c9e96
2 changed files with 48 additions and 4 deletions

View File

@ -0,0 +1,48 @@
diff --git a/dlls/dnsapi/libresolv.c b/dlls/dnsapi/libresolv.c
index ac52147..0f8c2ef 100644
--- wine-6.6/dlls/dnsapi/libresolv.c
+++ wine-6.6/dlls/dnsapi/libresolv.c
@@ -57,6 +57,43 @@
WINE_DEFAULT_DEBUG_CHANNEL(dnsapi);
+/* code from glibc's resolv/ns_name.c, with errno setting removed */
+/*%
+ * Advance *ptrptr to skip over the compressed name it points at.
+ *
+ * return:
+ *\li 0 on success, -1 (with errno set) on failure.
+ */
+#ifndef __GLIBC__
+static int
+ns_name_skip(const u_char **ptrptr, const u_char *eom)
+{
+ const u_char *cp;
+ u_int n;
+
+ cp = *ptrptr;
+ while (cp < eom && (n = *cp++) != 0) {
+ /* Check for indirection. */
+ switch (n & NS_CMPRSFLGS) {
+ case 0: /*%< normal case, n == len */
+ cp += n;
+ continue;
+ case NS_CMPRSFLGS: /*%< indirection */
+ cp++;
+ break;
+ default: /*%< illegal type */
+ return (-1);
+ }
+ break;
+ }
+ if (cp > eom) {
+ return (-1);
+ }
+ *ptrptr = cp;
+ return (0);
+}
+#endif
+
static const char *debugstr_type( unsigned short type )
{
const char *str;

View File

@ -64,10 +64,6 @@ if [ "$XBPS_LIBC" = "glibc" ]; then
hostmakedepends+=" prelink"
fi
if [ "$XBPS_LIBC" = "musl" ]; then
broken="undefined reference to `ns_name_skip'"
fi
_wine_libexec="/usr/libexec/wine"
nopie_files="${_wine_libexec}/wine${_wine_suffix}"