This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Small fix for Linux __opensock
- From: Wolfram Gloger <Wolfram dot Gloger at dent dot med dot uni-muenchen dot de>
- To: libc-alpha at sources dot redhat dot com
- Date: Fri, 15 Feb 2002 00:59:47 +0100 ("MET)
- Subject: Small fix for Linux __opensock
Hi,
Current glibc has failed "make check" for me when run on Linux-2.2.x;
test_ifindex reported that it couldn't get any interfaces (everything
is fine on Linux-2.4). The reason is that ioctl(fd, SIOCGIFCONF...)
fails on 2.2.x for all AF_UNIX sockets. So I would suggest that we
prefer AF_INET in __opensock() just like we did in glibc-2.2. There
was also a potential off-by-one error.
2002-02-15 Wolfram Gloger <wg@malloc.de>
* sysdeps/unix/sysv/linux/opensock.c: Fix size of fname buffer for
longest protocol name. Put AF_INET entry in front because kernels
before 2.4 fail SIOCGIFCONF for AF_UNIX sockets.
--- sysdeps/unix/sysv/linux/opensock.c~ Fri Dec 7 16:39:30 2001
+++ sysdeps/unix/sysv/linux/opensock.c Fri Feb 15 00:25:00 2002
@@ -36,8 +36,8 @@
const char procname[15];
} afs[] =
{
- { AF_UNIX, "net/unix" },
{ AF_INET, "" },
+ { AF_UNIX, "net/unix" },
{ AF_INET6, "net/if_inet6" },
{ AF_AX25, "net/ax25" },
{ AF_NETROM, "net/nr" },
@@ -49,7 +49,7 @@
{ AF_X25, "net/x25" }
};
#define nafs (sizeof (afs) / sizeof (afs[0]))
- char fname[sizeof "/proc/" + 14];
+ char fname[sizeof "/proc/" + sizeof afs[0].procname];
int result;
int has_proc;
int cnt;