mirror of
https://github.com/mirror/wget.git
synced 2025-02-11 12:20:16 +08:00
* src/utils.c (run_with_timeout): Set SIGALRM handler before setjmp() (reported by valgrind)
This commit is contained in:
parent
5fe01167d1
commit
a582633c97
@ -2176,16 +2176,16 @@ run_with_timeout (double timeout, void (*fun) (void *), void *arg)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Set alarm handler before doing setjmp. */
|
||||
signal (SIGALRM, abort_run_with_timeout);
|
||||
|
||||
if (SETJMP (run_with_timeout_env) != 0)
|
||||
{
|
||||
/* Longjumped out of FUN with a timeout. */
|
||||
signal (SIGALRM, SIG_DFL);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
signal (SIGALRM, abort_run_with_timeout);
|
||||
}
|
||||
|
||||
alarm_set (timeout);
|
||||
fun (arg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user