summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-04-30 09:40:55 +0000
committerUlrich Drepper <drepper@redhat.com>2000-04-30 09:40:55 +0000
commitedecfcda2a729916e7da9cc5d6e242d54ea5510e (patch)
tree8140acb426db927b2dd05da6f82b87edef573d92
parent01ed6c51892bc7d2e46266bc7bad06c9fffd4aa3 (diff)
downloadglibc-edecfcda2a729916e7da9cc5d6e242d54ea5510e.tar.gz
glibc-edecfcda2a729916e7da9cc5d6e242d54ea5510e.tar.xz
glibc-edecfcda2a729916e7da9cc5d6e242d54ea5510e.zip
Update.
	* sysdeps/unix/sysv/linux/if_index.c (if_nameindex): Set errno to
	ENOBUFS if we are out of memory.
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c8
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 24cdb640cf..e2883555b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2000-04-30  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/unix/sysv/linux/if_index.c (if_nameindex): Set errno to
+	ENOBUFS if we are out of memory.
+
 	* sysdeps/generic/bits/fcntl.h (F_SETOWN, F_GETOWN): Make
 	available if __USE_XOPEN2K.
 	* sysdeps/mach/hurd/bits/fcntl.h: Likewise.
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 44d310befe..764dac79e4 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000 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
@@ -133,6 +133,7 @@ if_nameindex (void)
   if (idx == NULL)
     {
       __close (fd);
+      __set_errno (ENOBUFS);
       return NULL;
     }
 
@@ -151,7 +152,10 @@ if_nameindex (void)
 	  free (idx);
 	  __close (fd);
 	  if (saved_errno == EINVAL)
-	    __set_errno (ENOSYS);
+	    saved_errno = ENOSYS;
+	  else if (saved_errno == ENOMEM)
+	    saved_errno = ENOBUFS;
+	  __set_errno (saved_errno);
 	  return NULL;
 	}
       idx[i].if_index = ifr->ifr_ifindex;