diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-04-24 08:55:46 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-04-24 08:55:46 +0000 |
commit | d0145e03799e484f3a53d79de3b3f34162ee9d3c (patch) | |
tree | d8c51a0952204f9015de0db3319d4c820e8646e0 /inet | |
parent | f5ce81c94cc27035f44d37bffa7f7e08dbce7631 (diff) | |
download | glibc-d0145e03799e484f3a53d79de3b3f34162ee9d3c.tar glibc-d0145e03799e484f3a53d79de3b3f34162ee9d3c.tar.gz glibc-d0145e03799e484f3a53d79de3b3f34162ee9d3c.tar.bz2 glibc-d0145e03799e484f3a53d79de3b3f34162ee9d3c.zip |
Updated to fedora-glibc-20060424T0820
Diffstat (limited to 'inet')
-rw-r--r-- | inet/check_pf.c | 10 | ||||
-rw-r--r-- | inet/getnameinfo.c | 25 | ||||
-rw-r--r-- | inet/inet6_option.c | 6 | ||||
-rw-r--r-- | inet/inet_ntoa.c | 69 | ||||
-rw-r--r-- | inet/rexec.c | 5 |
5 files changed, 28 insertions, 87 deletions
diff --git a/inet/check_pf.c b/inet/check_pf.c index 5d98c98aff..b015432659 100644 --- a/inet/check_pf.c +++ b/inet/check_pf.c @@ -1,5 +1,5 @@ /* Determine protocol families for which interfaces exist. Generic version. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +23,14 @@ void attribute_hidden -__check_pf (bool *seen_ipv4, bool *seen_ipv6) +__check_pf (bool *seen_ipv4, bool *seen_ipv6, + struct in6addrinfo **in6ai, size_t *in6ailen) { + /* By default we have no way to determine information about + deprecated and temporary addresses. */ + *in6ai = NULL; + *in6ailen = 0; + /* Get the interface list via getifaddrs. */ struct ifaddrs *ifa = NULL; if (getifaddrs (&ifa) != 0) diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index 493a423c10..5057fd221a 100644 --- a/inet/getnameinfo.c +++ b/inet/getnameinfo.c @@ -403,25 +403,16 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, if (!(flags & NI_NUMERICSERV)) { struct servent *s, ts; - while (__getservbyport_r (((const struct sockaddr_in *) sa)->sin_port, - ((flags & NI_DGRAM) ? "udp" : "tcp"), - &ts, tmpbuf, tmpbuflen, &s)) + int e; + while ((e = __getservbyport_r (((const struct sockaddr_in *) sa)->sin_port, + ((flags & NI_DGRAM) + ? "udp" : "tcp"), + &ts, tmpbuf, tmpbuflen, &s))) { - if (herrno == NETDB_INTERNAL) - { - if (errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, - 2 * tmpbuflen); - else - { - __set_errno (serrno); - return EAI_SYSTEM; - } - } + if (e == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); else - { - break; - } + break; } if (s) { diff --git a/inet/inet6_option.c b/inet/inet6_option.c index 2e0fed8a30..f88982e323 100644 --- a/inet/inet6_option.c +++ b/inet/inet6_option.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -251,7 +251,7 @@ inet6_option_next (cmsg, tptrp) const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8; const uint8_t *result; - if (tptrp == NULL) + if (*tptrp == NULL) /* This is the first call, return the first option if there is one. */ result = (const uint8_t *) (ip6e + 1); else @@ -308,7 +308,7 @@ inet6_option_find (cmsg, tptrp, type) const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8; const uint8_t *next; - if (tptrp == NULL) + if (*tptrp == NULL) /* This is the first call, return the first option if there is one. */ next = (const uint8_t *) (ip6e + 1); else diff --git a/inet/inet_ntoa.c b/inet/inet_ntoa.c index 889435dd10..38794957c2 100644 --- a/inet/inet_ntoa.c +++ b/inet/inet_ntoa.c @@ -21,78 +21,19 @@ #include <stdio.h> #include <stdlib.h> #include <arpa/inet.h> -#include <bits/libc-lock.h> /* The interface of this function is completely stupid, it requires a - static buffer. We relax this a bit in that we allow at least one - buffer for each thread. */ - -/* This is the key for the thread specific memory. */ -static __libc_key_t key; - -/* If nonzero the key allocation failed and we should better use a - static buffer than fail. */ -static char local_buf[18]; -static char *static_buf; - -/* Destructor for the thread-specific data. */ -static void init (void); -static void free_key_mem (void *mem); + static buffer. We relax this a bit in that we allow one buffer for + each thread. */ +static __thread char buffer[18]; char * inet_ntoa (struct in_addr in) { - __libc_once_define (static, once); - char *buffer; - unsigned char *bytes; - - /* If we have not yet initialized the buffer do it now. */ - __libc_once (once, init); - - if (static_buf != NULL) - buffer = static_buf; - else - { - /* We don't use the static buffer and so we have a key. Use it - to get the thread-specific buffer. */ - buffer = __libc_getspecific (key); - if (buffer == NULL) - { - /* No buffer allocated so far. */ - buffer = malloc (18); - if (buffer == NULL) - /* No more memory available. We use the static buffer. */ - buffer = local_buf; - else - __libc_setspecific (key, buffer); - } - } - - bytes = (unsigned char *) ∈ - __snprintf (buffer, 18, "%d.%d.%d.%d", + unsigned char *bytes = (unsigned char *) ∈ + __snprintf (buffer, sizeof (buffer), "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]); return buffer; } - - -/* Initialize buffer. */ -static void -init (void) -{ - if (__libc_key_create (&key, free_key_mem)) - /* Creating the key failed. This means something really went - wrong. In any case use a static buffer which is better than - nothing. */ - static_buf = local_buf; -} - - -/* Free the thread specific data, this is done if a thread terminates. */ -static void -free_key_mem (void *mem) -{ - free (mem); - __libc_setspecific (key, NULL); -} diff --git a/inet/rexec.c b/inet/rexec.c index 6deb1feb45..07ddeeafea 100644 --- a/inet/rexec.c +++ b/inet/rexec.c @@ -87,8 +87,11 @@ rexec_af(ahost, rport, name, pass, cmd, fd2p, af) return (-1); } *ahost = ahostbuf; - } else + } else { *ahost = NULL; + __set_errno (ENOENT); + return -1; + } ruserpass(res0->ai_canonname, &name, &pass); retry: s = __socket(res0->ai_family, res0->ai_socktype, 0); |