]> Git Repo - uclibc-ng.git/commitdiff
Proper support for setting h_errno
authorEric Andersen <[email protected]>
Tue, 26 Feb 2002 09:35:50 +0000 (09:35 -0000)
committerEric Andersen <[email protected]>
Tue, 26 Feb 2002 09:35:50 +0000 (09:35 -0000)
libc/misc/internals/Makefile
libc/misc/internals/__h_errno_location.c [new file with mode: 0644]
libc/misc/internals/__uClibc_main.c

index c81e02078659d6e4943d933c2860aaafa5cce1e9..6e1c2c29df914ab2e1b6b0af3b2fc01c2de7eadf 100644 (file)
@@ -24,7 +24,7 @@
 TOPDIR=../../../
 include $(TOPDIR)Rules.mak
 
-CSRC=ultostr.c ltostr.c __uClibc_main.c tempname.c errno.c __errno_location.c
+CSRC=ultostr.c ltostr.c __uClibc_main.c tempname.c errno.c __errno_location.c __h_errno_location.c
 ifeq ($(HAS_FLOATING_POINT),true)
        CSRC += dtostr.c zoicheck.c
 endif
diff --git a/libc/misc/internals/__h_errno_location.c b/libc/misc/internals/__h_errno_location.c
new file mode 100644 (file)
index 0000000..f4f5980
--- /dev/null
@@ -0,0 +1,10 @@
+#define __FORCE_GLIBC
+#include <features.h>
+#include <netdb.h>
+#undef h_errno
+
+int * weak_const_function __h_errno_location (void)
+{
+    return &h_errno;
+}
+
index ffe8ad8137da6657e865385c7020e2daeeee98e6..7f5e6e805b4a3136a49c03c44704c8fc99499658 100644 (file)
@@ -30,11 +30,13 @@ void __uClibc_main(int argc, char **argv, char **envp)
 weak_alias(__environ, environ);
 extern void weak_function __init_stdio(void);
 extern void weak_function __stdio_flush_buffers(void);
-extern int *weak_function __errno_location (void);
+extern int *weak_const_function __errno_location (void);
+extern int *weak_const_function __h_errno_location (void);
 #else
 extern void __init_stdio(void);
 extern void __stdio_flush_buffers(void);
 extern int *__errno_location (void);
+extern int *__h_errno_location (void);
 #endif 
 
 /*
@@ -79,6 +81,9 @@ void __uClibc_main(int argc, char **argv, char **envp)
         */
        if (__errno_location)
            *(__errno_location()) = 0;
+       /* Set h_errno to 0 as well */
+       if (__h_errno_location)
+           *(__h_errno_location()) = 0;
 
        /*
         * Finally, invoke application's main and then exit.
This page took 0.034187 seconds and 4 git commands to generate.