mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
* sysdeps/generic/ifreq.h (__if_nextreq): New function.
* sysdeps/unix/sysv/linux/ifreq.h (__if_nextreq): New function. * sysdeps/mach/hurd/ifreq.h (__if_nextreq): New function. * sysdeps/gnu/ifaddrs.c (getifaddrs): Use __if_nextreq for iterating through the list of interfaces. * resolv/res_hconf.c (_res_hconf_reorder_addrs): Likewise. * sysdeps/unix/grantpt.c (pts_name): Set errno when __ptsname_r fails. Reported by Bruno Haible <bruno@clisp.org>.
This commit is contained in:
parent
dab9837091
commit
9db6ee8d2f
12
ChangeLog
12
ChangeLog
@ -1,5 +1,17 @@
|
||||
2002-09-17 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
* sysdeps/generic/ifreq.h (__if_nextreq): New function.
|
||||
* sysdeps/unix/sysv/linux/ifreq.h (__if_nextreq): New function.
|
||||
* sysdeps/mach/hurd/ifreq.h (__if_nextreq): New function.
|
||||
* sysdeps/gnu/ifaddrs.c (getifaddrs): Use __if_nextreq
|
||||
for iterating through the list of interfaces.
|
||||
* resolv/res_hconf.c (_res_hconf_reorder_addrs): Likewise.
|
||||
|
||||
2002-09-20 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sysdeps/unix/grantpt.c (pts_name): Set errno when __ptsname_r fails.
|
||||
Reported by Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
* sysdeps/unix/bsd/bsd4.4/isatty.c: New file.
|
||||
|
||||
* sysdeps/unix/bsd/isatty.c (__isatty): Don't save and restore errno.
|
||||
|
@ -1,3 +1,13 @@
|
||||
2002-09-18 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
* Examples/ex10.c (thread): Fail if pthread_mutex_timedlock() returns
|
||||
an unexpected error code.
|
||||
|
||||
* internals.h (__pthread_message): Add const to first parameter type.
|
||||
* pthread.c (__pthread_message): Likewise.
|
||||
|
||||
* sysdeps/unix/sysv/linux/configure: Moved to ../sysdeps/pthread.
|
||||
|
||||
2002-09-17 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sysdeps/i386/tls.h (TLS_DO_MODIFY_LDT, TLS_DO_SET_THREAD_AREA):
|
||||
|
@ -1,3 +1,9 @@
|
||||
2002-09-20 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* gen-locale.sh (generate_locale): Clean up overly baroque sh syntax.
|
||||
Touch the LC_CTYPE file of the output after a successful run.
|
||||
Reported by Bruno Haible <bruno@clisp.org>.
|
||||
|
||||
2002-09-10 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* localedata/locales/bg_BG: Update LC_IDENTIFICATION info.
|
||||
|
@ -556,7 +556,7 @@ _res_hconf_reorder_addrs (struct hostent *hp)
|
||||
goto cleanup1;
|
||||
|
||||
/* Copy usable interfaces in ifaddrs structure. */
|
||||
for (cur_ifr = ifr, i = 0; i < num; ++cur_ifr, ++i)
|
||||
for (cur_ifr = ifr, i = 0; i < num; cur_ifr = __if_nextreq (cur_ifr), ++i)
|
||||
{
|
||||
if (cur_ifr->ifr_addr.sa_family != AF_INET)
|
||||
continue;
|
||||
|
@ -73,6 +73,13 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
|
||||
}
|
||||
|
||||
|
||||
static inline struct ifreq *
|
||||
__if_nextreq (struct ifreq *ifr)
|
||||
{
|
||||
return ifr + 1;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
__if_freereq (struct ifreq *ifreqs, int num_ifs)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ getifaddrs (struct ifaddrs **ifap)
|
||||
Some different mechanism entirely must be used for IPv6. */
|
||||
int fd = __socket (AF_INET, SOCK_DGRAM, 0);
|
||||
struct ifreq *ifreqs;
|
||||
int nifs, i;
|
||||
int nifs;
|
||||
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
@ -64,6 +64,8 @@ getifaddrs (struct ifaddrs **ifap)
|
||||
struct sockaddr addr, netmask, broadaddr;
|
||||
char name[IF_NAMESIZE];
|
||||
} *storage;
|
||||
struct ifreq *ifr;
|
||||
int i;
|
||||
|
||||
storage = malloc (nifs * sizeof storage[0]);
|
||||
if (storage == NULL)
|
||||
@ -74,10 +76,9 @@ getifaddrs (struct ifaddrs **ifap)
|
||||
}
|
||||
|
||||
i = 0;
|
||||
ifr = ifreqs;
|
||||
do
|
||||
{
|
||||
struct ifreq *const ifr = &ifreqs[i];
|
||||
|
||||
/* Fill in all pointers to the storage we've already allocated. */
|
||||
storage[i].ia.ifa_next = &storage[i + 1].ia;
|
||||
storage[i].ia.ifa_addr = &storage[i].addr;
|
||||
@ -97,6 +98,7 @@ getifaddrs (struct ifaddrs **ifap)
|
||||
storage[i].ia.ifa_flags = ifr->ifr_flags;
|
||||
|
||||
ifr->ifr_addr = storage[i].addr;
|
||||
|
||||
if (__ioctl (fd, SIOCGIFNETMASK, ifr) < 0)
|
||||
break;
|
||||
storage[i].netmask = ifr->ifr_netmask;
|
||||
@ -121,6 +123,7 @@ getifaddrs (struct ifaddrs **ifap)
|
||||
|
||||
storage[i].ia.ifa_data = NULL; /* Nothing here for now. */
|
||||
|
||||
ifr = __if_nextreq (ifr);
|
||||
} while (++i < nifs);
|
||||
if (i < nifs) /* Broke out early on error. */
|
||||
{
|
||||
@ -129,6 +132,7 @@ getifaddrs (struct ifaddrs **ifap)
|
||||
__if_freereq (ifreqs, nifs);
|
||||
return -1;
|
||||
}
|
||||
|
||||
storage[i - 1].ia.ifa_next = NULL;
|
||||
|
||||
*ifap = &storage[0].ia;
|
||||
|
@ -66,6 +66,13 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
|
||||
}
|
||||
|
||||
|
||||
static inline struct ifreq *
|
||||
__if_nextreq (struct ifreq *ifr)
|
||||
{
|
||||
return ifr + 1;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
__if_freereq (struct ifreq *ifreqs, int num_ifs)
|
||||
{
|
||||
|
@ -55,7 +55,8 @@ pts_name (int fd, char **pts, size_t buf_len)
|
||||
/* ptsname_r returns with ENOTTY to indicate
|
||||
a descriptor not referring to a pty master.
|
||||
For this condition, grantpt must return EINVAL. */
|
||||
errno = EINVAL;
|
||||
rv = EINVAL;
|
||||
errno = rv; /* Not necessarily set by __ptsname_r. */
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,12 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
|
||||
*ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq));
|
||||
}
|
||||
|
||||
static inline struct ifreq *
|
||||
__if_nextreq (struct ifreq *ifr)
|
||||
{
|
||||
return ifr + 1;
|
||||
}
|
||||
|
||||
static inline void
|
||||
__if_freereq (struct ifreq *ifreqs, int num_ifs)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user