]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/names-net.c
windows: Comment on MSVC inline asm issues
[pciutils.git] / lib / names-net.c
index a1a6e275dd4bcf6c2c4966b4255c6c883dd73420..14141f4c2be879cd6d96e740422f3acea16d9579 100644 (file)
@@ -3,17 +3,28 @@
  *
  *     Copyright (c) 2007--2008 Martin Mares <mj@ucw.cz>
  *
- *     Can be freely distributed and used under the terms of the GNU GPL.
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include <string.h>
 #include <stdlib.h>
+#include <stdio.h>
 
 #include "internal.h"
 #include "names.h"
 
 #ifdef PCI_USE_DNS
 
+/*
+ * Our definition of BYTE_ORDER confuses arpa/nameser_compat.h on
+ * Solaris so we must undef it before including arpa/nameser.h.
+ */
+#ifdef PCI_OS_SUNOS
+#undef BYTE_ORDER
+#endif
+
 #include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
@@ -75,7 +86,8 @@ static int
 dns_parse_packet(struct dns_state *s, byte *p, unsigned int plen)
 {
   byte *end = p + plen;
-  unsigned int i, j, x, len;
+  unsigned int i, j, len;
+  unsigned int UNUSED x;
 
 #if 0
   /* Dump the packet */
@@ -186,7 +198,7 @@ char
     default:
       return NULL;
     }
-  sprintf(dnsname, "%s.%s", name, domain);
+  sprintf(dnsname, "%.100s.%.100s", name, domain);
 
   a->debug("Resolving %s\n", dnsname);
   if (!resolver_inited)