LibC: Fix `signal` return value
signal was returning `func` when it should've returned the old handler
This commit is contained in:
parent
7691b019e2
commit
69c4940b27
|
@ -121,14 +121,14 @@ int sigismember(const sigset_t* set, int signo)
|
|||
|
||||
void (*signal(int sig, void (*func)(int)))(int)
|
||||
{
|
||||
struct sigaction act;
|
||||
struct sigaction act, oact;
|
||||
act.sa_handler = func;
|
||||
act.sa_flags = 0;
|
||||
|
||||
int ret = sigaction(sig, &act, nullptr);
|
||||
int ret = sigaction(sig, &act, &oact);
|
||||
if (ret == -1)
|
||||
return SIG_ERR;
|
||||
return func;
|
||||
return oact.sa_handler;
|
||||
}
|
||||
|
||||
int sigpending(sigset_t* set)
|
||||
|
|
Loading…
Reference in New Issue