2003-09-12 Ulrich Drepper <drepper@redhat.com>
+ * sysdeps/unix/sysv/linux/if_index.c: Use only non-cancelable
+ interfaces.
+
* grp/Makefile (CFLAGS-getgrgid_r.c, CFLAGS-getgrnam_r.c,
CFLAGS-fgetgrent.c, CFLAGS-fgetgrent_r.c, CFLAGS-putgrent.c,
CFLAGS-initgroups.c, CFLAGS-getgrgid.c): Add -fexceptions.
-/* Copyright (C) 1997,98,99,2000,02 Free Software Foundation, Inc.
+/* Copyright (C) 1997,98,99,2000,2002,2003 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
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <bits/libc-lock.h>
+#include <not-cancel.h>
#include "kernel-features.h"
if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
{
int saved_errno = errno;
- __close (fd);
+ close_not_cancel_no_status (fd);
if (saved_errno == EINVAL)
__set_errno (ENOSYS);
return 0;
}
- __close (fd);
+ close_not_cancel_no_status (fd);
return ifr.ifr_ifindex;
#endif
}
do
{
ifc.ifc_buf = alloca (ifc.ifc_len = rq_len);
- if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
+ if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0)
{
- __close (fd);
+ close_not_cancel_no_status (fd);
return NULL;
}
rq_len *= 2;
idx = malloc ((nifs + 1) * sizeof (struct if_nameindex));
if (idx == NULL)
{
- __close (fd);
+ close_not_cancel_no_status (fd);
__set_errno (ENOBUFS);
return NULL;
}
for (j = 0; j < i; ++j)
free (idx[j].if_name);
free (idx);
- __close (fd);
+ close_not_cancel_no_status (fd);
if (saved_errno == EINVAL)
saved_errno = ENOSYS;
else if (saved_errno == ENOMEM)
idx[i].if_index = 0;
idx[i].if_name = NULL;
- __close (fd);
+ close_not_cancel_no_status (fd);
return idx;
#endif
}
ifr.ifr_ifindex = ifindex;
status = __ioctl (fd, SIOCGIFNAME, &ifr);
- __close (fd);
+ close_not_cancel_no_status (fd);
# if __ASSUME_SIOCGIFNAME == 0
if (status < 0)
do
{
ifc.ifc_buf = alloca (ifc.ifc_len = rq_len);
- if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
+ if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0)
{
- __close (fd);
+ close_not_cancel_no_status (fd);
return;
}
rq_len *= 2;
break;
}
- __close (fd);
+ close_not_cancel_no_status (fd);
}
#endif