mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
* sysdeps/unix/sysv/linux/if_index.c: Use only non-cancelable interfaces.
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
2003-09-12 Ulrich Drepper <drepper@redhat.com>
|
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,
|
* grp/Makefile (CFLAGS-getgrgid_r.c, CFLAGS-getgrnam_r.c,
|
||||||
CFLAGS-fgetgrent.c, CFLAGS-fgetgrent_r.c, CFLAGS-putgrent.c,
|
CFLAGS-fgetgrent.c, CFLAGS-fgetgrent_r.c, CFLAGS-putgrent.c,
|
||||||
CFLAGS-initgroups.c, CFLAGS-getgrgid.c): Add -fexceptions.
|
CFLAGS-initgroups.c, CFLAGS-getgrgid.c): Add -fexceptions.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* 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.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -25,6 +25,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
|
#include <not-cancel.h>
|
||||||
|
|
||||||
#include "kernel-features.h"
|
#include "kernel-features.h"
|
||||||
|
|
||||||
@ -53,12 +54,12 @@ if_nametoindex (const char *ifname)
|
|||||||
if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
|
if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
__close (fd);
|
close_not_cancel_no_status (fd);
|
||||||
if (saved_errno == EINVAL)
|
if (saved_errno == EINVAL)
|
||||||
__set_errno (ENOSYS);
|
__set_errno (ENOSYS);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
__close (fd);
|
close_not_cancel_no_status (fd);
|
||||||
return ifr.ifr_ifindex;
|
return ifr.ifr_ifindex;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -120,9 +121,9 @@ if_nameindex (void)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ifc.ifc_buf = alloca (ifc.ifc_len = rq_len);
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
rq_len *= 2;
|
rq_len *= 2;
|
||||||
@ -134,7 +135,7 @@ if_nameindex (void)
|
|||||||
idx = malloc ((nifs + 1) * sizeof (struct if_nameindex));
|
idx = malloc ((nifs + 1) * sizeof (struct if_nameindex));
|
||||||
if (idx == NULL)
|
if (idx == NULL)
|
||||||
{
|
{
|
||||||
__close (fd);
|
close_not_cancel_no_status (fd);
|
||||||
__set_errno (ENOBUFS);
|
__set_errno (ENOBUFS);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -152,7 +153,7 @@ if_nameindex (void)
|
|||||||
for (j = 0; j < i; ++j)
|
for (j = 0; j < i; ++j)
|
||||||
free (idx[j].if_name);
|
free (idx[j].if_name);
|
||||||
free (idx);
|
free (idx);
|
||||||
__close (fd);
|
close_not_cancel_no_status (fd);
|
||||||
if (saved_errno == EINVAL)
|
if (saved_errno == EINVAL)
|
||||||
saved_errno = ENOSYS;
|
saved_errno = ENOSYS;
|
||||||
else if (saved_errno == ENOMEM)
|
else if (saved_errno == ENOMEM)
|
||||||
@ -166,7 +167,7 @@ if_nameindex (void)
|
|||||||
idx[i].if_index = 0;
|
idx[i].if_index = 0;
|
||||||
idx[i].if_name = NULL;
|
idx[i].if_name = NULL;
|
||||||
|
|
||||||
__close (fd);
|
close_not_cancel_no_status (fd);
|
||||||
return idx;
|
return idx;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -208,7 +209,7 @@ if_indextoname (unsigned int ifindex, char *ifname)
|
|||||||
ifr.ifr_ifindex = ifindex;
|
ifr.ifr_ifindex = ifindex;
|
||||||
status = __ioctl (fd, SIOCGIFNAME, &ifr);
|
status = __ioctl (fd, SIOCGIFNAME, &ifr);
|
||||||
|
|
||||||
__close (fd);
|
close_not_cancel_no_status (fd);
|
||||||
|
|
||||||
# if __ASSUME_SIOCGIFNAME == 0
|
# if __ASSUME_SIOCGIFNAME == 0
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@ -288,9 +289,9 @@ __protocol_available (int *have_inet, int *have_inet6)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ifc.ifc_buf = alloca (ifc.ifc_len = rq_len);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
rq_len *= 2;
|
rq_len *= 2;
|
||||||
@ -317,6 +318,6 @@ __protocol_available (int *have_inet, int *have_inet6)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
__close (fd);
|
close_not_cancel_no_status (fd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user