server: Convert non-afs commands to lopsub.
[paraslash.git] / net.c
diff --git a/net.c b/net.c
index 42418e5f20d9e168eb0af5c7da9c2d1ffa1c2127..fa7cd4b80a7d96b26e35add01ad97d9a123f138d 100644 (file)
--- a/net.c
+++ b/net.c
@@ -6,11 +6,7 @@
 
 /** \file net.c Networking-related helper functions. */
 
-/*
- * Since glibc 2.8, the _GNU_SOURCE feature test macro must be defined in order
- * to obtain the definition of the ucred structure.
- */
-#define _GNU_SOURCE
+#include "para.h"
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -32,7 +28,6 @@
 
 #include <regex.h>
 
-#include "para.h"
 #include "error.h"
 #include "net.h"
 #include "string.h"
@@ -180,8 +175,7 @@ char *parse_url(const char *url,
        }
 
        if (*o == ':')
-               if (para_atoi32(++o, port) < 0 ||
-                   *port < 0 || *port > 0xffff)
+               if (para_atoi32(++o, port) < 0 || *port < 0 || *port > 0xffff)
                        goto failed;
        if (host_string_ok(host))
                return host;
@@ -192,6 +186,7 @@ failed:
 
 /**
  * Stringify port number, resolve into service name where defined.
+ *
  * \param port 2-byte port number, in host-byte-order.
  * \param transport Transport protocol name (e.g. "udp", "tcp"), or NULL.
  * \return Pointer to static result buffer.
@@ -381,7 +376,7 @@ int lookup_address(unsigned l4type, bool passive, const char *host,
        struct addrinfo *addr = NULL, hints;
 
        *result = NULL;
-       sprintf(port, "%u", port_number & 0xffff);
+       sprintf(port, "%d", port_number & 0xffff);
        /* Set up address hint structure */
        memset(&hints, 0, sizeof(hints));
        hints.ai_family = AF_UNSPEC;