]> sjero.net Git - wget/commitdiff
[svn] Fix broken Windows builds due to the xxx_with_timeout stuff.
authorabbotti <devnull@localhost>
Mon, 15 Apr 2002 19:01:56 +0000 (12:01 -0700)
committerabbotti <devnull@localhost>
Mon, 15 Apr 2002 19:01:56 +0000 (12:01 -0700)
Submitted by Ian Abbotti in <3CBB2FFE.20193.73A594@localhost>.

src/ChangeLog
src/host.c
src/utils.c

index e1f725b85da64fe131fd3aeb615a6238ce08a65f..c6ace5b5476e396ee448d439362e7eee003a67a1 100644 (file)
@@ -1,3 +1,11 @@
+2002-04-15  Ian Abbott  <abbotti@mev.co.uk>
+
+       * host.c (SET_H_ERRNO): New function-like macro to set `h_errno'.
+       (gethostbyname_with_timeout): Use it.
+
+       * utils.c: Don't define `SETJMP()', `run_with_timeout_env' or
+       `abort_run_with_timeout()' when `USE_SIGNAL_TIMEOUT' is undefined.
+
 2002-04-15  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * host.c (getaddrinfo_with_timeout): New function.
index 62485c6e879ccc0de421ad93786c499e7e18cc86..5f41ace699a382b36036691e3aad978aac300d6a 100644 (file)
@@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #ifdef WINDOWS
 # include <winsock.h>
+# define SET_H_ERRNO(err) WSASetLastError(err)
 #else
 # include <sys/socket.h>
 # include <netinet/in.h>
@@ -42,6 +43,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #  include <arpa/inet.h>
 # endif
 # include <netdb.h>
+# define SET_H_ERRNO(err) ((void)(h_errno = (err)))
 #endif /* WINDOWS */
 
 #ifndef NO_ADDRESS
@@ -487,7 +489,7 @@ gethostbyname_with_timeout (const char *host_name, int timeout)
   ctx.host_name = host_name;
   if (run_with_timeout (timeout, gethostbyname_with_timeout_callback, &ctx))
     {
-      h_errno = HOST_NOT_FOUND;
+      SET_H_ERRNO (HOST_NOT_FOUND);
       errno = ETIMEDOUT;
       return NULL;
     }
index a84237ee130eae8ac420a4f8d8e008fcd46c6bd1..0756fde98bc18b5501d0a0fee63566ce166e65cd 100644 (file)
@@ -1812,8 +1812,9 @@ debug_test_md5 (char *buf)
 \f
 /* Implementation of run_with_timeout, a generic timeout handler for
    systems with Unix-like signal handling.  */
-#ifdef HAVE_SIGSETJMP
-#define SETJMP(env) sigsetjmp (env, 1)
+#ifdef USE_SIGNAL_TIMEOUT
+# ifdef HAVE_SIGSETJMP
+#  define SETJMP(env) sigsetjmp (env, 1)
 
 static sigjmp_buf run_with_timeout_env;
 
@@ -1823,8 +1824,8 @@ abort_run_with_timeout (int sig)
   assert (sig == SIGALRM);
   siglongjmp (run_with_timeout_env, -1);
 }
-#else  /* not HAVE_SIGSETJMP */
-#define SETJMP(env) setjmp (env)
+# else /* not HAVE_SIGSETJMP */
+#  define SETJMP(env) setjmp (env)
 
 static jmp_buf run_with_timeout_env;
 
@@ -1842,7 +1843,8 @@ abort_run_with_timeout (int sig)
   /* Now it's safe to longjump. */
   longjmp (run_with_timeout_env, -1);
 }
-#endif /* not HAVE_SIGSETJMP */
+# endif /* not HAVE_SIGSETJMP */
+#endif /* USE_SIGNAL_TIMEOUT */
 
 int
 run_with_timeout (long timeout, void (*fun) (void *), void *arg)