From: abbotti Date: Mon, 15 Apr 2002 19:01:56 +0000 (-0700) Subject: [svn] Fix broken Windows builds due to the xxx_with_timeout stuff. X-Git-Tag: v1.13~1788 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=caa0f23be327ed0ba7fa50cfa5da27030db0f884 [svn] Fix broken Windows builds due to the xxx_with_timeout stuff. Submitted by Ian Abbotti in <3CBB2FFE.20193.73A594@localhost>. --- diff --git a/src/ChangeLog b/src/ChangeLog index e1f725b8..c6ace5b5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2002-04-15 Ian Abbott + + * 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 * host.c (getaddrinfo_with_timeout): New function. diff --git a/src/host.c b/src/host.c index 62485c6e..5f41ace6 100644 --- a/src/host.c +++ b/src/host.c @@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef WINDOWS # include +# define SET_H_ERRNO(err) WSASetLastError(err) #else # include # include @@ -42,6 +43,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ # include # endif # include +# 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; } diff --git a/src/utils.c b/src/utils.c index a84237ee..0756fde9 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1812,8 +1812,9 @@ debug_test_md5 (char *buf) /* 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)