mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Fix broken Windows builds due to the xxx_with_timeout stuff.
Submitted by Ian Abbotti in <3CBB2FFE.20193.73A594@localhost>.
This commit is contained in:
parent
886470568c
commit
caa0f23be3
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
12
src/utils.c
12
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)
|
||||
|
Loading…
Reference in New Issue
Block a user