diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-05 23:37:40 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-05 23:37:40 +0200 |
commit | fdf14ae2e653f275c085329b183373e1fb062693 (patch) | |
tree | af64aedb51e30bda270721bf37729bcb1f4cb567 /libc/inet/if_index.c | |
parent | a76558a92e21643a628c3c6a8cd22816634b1749 (diff) |
do not save/restore errno around free() calls
In any non-buggy program free() does not fail.
And when it fails in a buggy program, the failure
is usually fatal (heap corruption and segfault).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libc/inet/if_index.c')
-rw-r--r-- | libc/inet/if_index.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/libc/inet/if_index.c b/libc/inet/if_index.c index 4100bbf17..090b52a15 100644 --- a/libc/inet/if_index.c +++ b/libc/inet/if_index.c @@ -35,14 +35,6 @@ #include "netlinkaccess.h" -/* Experimentally off - libc_hidden_proto(strncpy) */ -/* Experimentally off - libc_hidden_proto(strdup) */ -/* libc_hidden_proto(ioctl) */ -/* libc_hidden_proto(close) */ -#if __ASSUME_NETLINK_SUPPORT -/* Experimentally off - libc_hidden_proto(strndup) */ -#endif - extern int __opensock(void) attribute_hidden; /* libc_hidden_proto(if_nametoindex) */ @@ -62,10 +54,11 @@ if_nametoindex(const char* ifname) strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); if (ioctl (fd, SIOCGIFINDEX, &ifr) < 0) { - int saved_errno = errno; + // close never fails here, fd is just a unconnected socket + //int saved_errno = errno; close(fd); - if (saved_errno == EINVAL) - __set_errno(ENOSYS); + //if (saved_errno == EINVAL) + // __set_errno(ENOSYS); return 0; } |