mirror of
https://github.com/mirror/wget.git
synced 2025-02-15 06:10:23 +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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set alarm handler before doing setjmp. */
|
||||||
|
signal (SIGALRM, abort_run_with_timeout);
|
||||||
|
|
||||||
if (SETJMP (run_with_timeout_env) != 0)
|
if (SETJMP (run_with_timeout_env) != 0)
|
||||||
{
|
{
|
||||||
/* Longjumped out of FUN with a timeout. */
|
/* Longjumped out of FUN with a timeout. */
|
||||||
signal (SIGALRM, SIG_DFL);
|
signal (SIGALRM, SIG_DFL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
signal (SIGALRM, abort_run_with_timeout);
|
|
||||||
}
|
|
||||||
alarm_set (timeout);
|
alarm_set (timeout);
|
||||||
fun (arg);
|
fun (arg);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user