X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=net.c;h=fa7cd4b80a7d96b26e35add01ad97d9a123f138d;hp=463033bb710a36036ca37907ecc59016fd6dd304;hb=52fb766fd183e555d8c85185e35a4dc365097756;hpb=68630d8b55d688a7c7ce116951c310150aa9c166 diff --git a/net.c b/net.c index 463033bb..fa7cd4b8 100644 --- 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 #include @@ -32,7 +28,6 @@ #include -#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; @@ -1018,7 +1013,7 @@ static void dispose_fds(int *fds, unsigned num) */ int recv_cred_buffer(int fd, char *buf, size_t size) { - char control[255]; + char control[255] __a_aligned(8); struct msghdr msg; struct cmsghdr *cmsg; struct iovec iov;