aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-06-29 04:43:45 +0000
committerUlrich Drepper <drepper@redhat.com>2004-06-29 04:43:45 +0000
commit16ac7d456d14d22c2071e9151a0b78626d0d71c9 (patch)
tree7a385893ff11467a9c7c0df74b174286313c5f51
parent414650c52c8988b829ccc6c2a5763c33d86de55c (diff)
downloadglibc-16ac7d456d14d22c2071e9151a0b78626d0d71c9.tar
glibc-16ac7d456d14d22c2071e9151a0b78626d0d71c9.tar.gz
glibc-16ac7d456d14d22c2071e9151a0b78626d0d71c9.tar.bz2
glibc-16ac7d456d14d22c2071e9151a0b78626d0d71c9.zip
Update.
* inet/bug-if1.c (do_test): Simply use 0 as invalid index.
-rw-r--r--ChangeLog2
-rw-r--r--inet/bug-if1.c24
2 files changed, 4 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 5215a58c59..8ea8fdeb7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2004-06-28 Ulrich Drepper <drepper@redhat.com>
+ * inet/bug-if1.c (do_test): Simply use 0 as invalid index.
+
* sysdeps/unix/sysv/linux/if_index.c (if_nameindex): Use extend_alloca.
2004-06-28 GOTO Masanori <gotom@debian.or.jp>
diff --git a/inet/bug-if1.c b/inet/bug-if1.c
index aa9925d6a7..6bcd175ebc 100644
--- a/inet/bug-if1.c
+++ b/inet/bug-if1.c
@@ -27,29 +27,9 @@
static int
do_test (void)
{
- /* Get list of all interfaces. */
- struct if_nameindex *il = if_nameindex ();
- if (il == NULL)
- {
- puts ("cannot get interface list, maybe the system does not support networking; bailing out");
- return 0;
- }
-
- /* Determine the highest interface number. */
- unsigned int max = 0;
- for (int cnt = 0; il[cnt].if_name != NULL; ++cnt)
- if (il[cnt].if_index > max)
- max = il[cnt].if_index;
-
- /* Use the next higher value (if possible). */
- if (max == UINT_MAX)
- {
- puts ("highest index too high; need more clever way to determine test index");
- return 0;
- }
-
char buf[IF_NAMESIZE];
- char *cp = if_indextoname (max + 1, buf);
+ /* Index 0 is always invalid (see RFC 3493). */
+ char *cp = if_indextoname (0, buf);
if (cp != NULL)
{
printf ("invalid index returned result \"%s\"\n", cp);