This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Small fix for Linux __opensock


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  <>

	* 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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]