summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/if_index.c15
-rw-r--r--libc/inet/ifaddrs.c5
-rw-r--r--libc/misc/dirent/opendir.c9
3 files changed, 10 insertions, 19 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;
}
diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c
index 1d54d5123..77ca7ce02 100644
--- a/libc/inet/ifaddrs.c
+++ b/libc/inet/ifaddrs.c
@@ -81,7 +81,6 @@ void
__netlink_free_handle (struct netlink_handle *h)
{
struct netlink_res *ptr;
- int saved_errno = errno;
ptr = h->nlm_list;
while (ptr != NULL)
@@ -89,11 +88,9 @@ __netlink_free_handle (struct netlink_handle *h)
struct netlink_res *tmpptr;
tmpptr = ptr->next;
- free (ptr);
+ free (ptr); /* doesn't affect errno */
ptr = tmpptr;
}
-
- __set_errno (saved_errno);
}
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index 70b30658e..672ef15a4 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -87,16 +87,17 @@ DIR *opendir(const char *name)
fd = open(name, O_RDONLY|O_NDELAY|O_DIRECTORY|O_CLOEXEC);
if (fd < 0)
return NULL;
-
/* Note: we should check to make sure that between the stat() and open()
* call, 'name' didnt change on us, but that's only if O_DIRECTORY isnt
* defined and since Linux has supported it for like ever, i'm not going
* to worry about it right now (if ever). */
+
if (fstat(fd, &statbuf) < 0) {
- int saved_errno;
- saved_errno = errno;
+ // this close() never fails
+ //int saved_errno;
+ //saved_errno = errno;
close(fd);
- __set_errno(saved_errno);
+ //__set_errno(saved_errno);
return NULL;
}