1
0
mirror of https://git.tukaani.org/xz.git synced 2025-12-11 16:08:45 +00:00

xz: Check return value of sigaction() before calling raise()

Fixes: Coverity CID 456022
This commit is contained in:
Lasse Collin 2025-11-25 21:05:37 +02:00
parent 6cc2da0a4b
commit c410ccc625
No known key found for this signature in database
GPG Key ID: 38EE757D69184620

View File

@ -187,8 +187,14 @@ signals_exit(void)
sa.sa_handler = SIG_DFL;
sigfillset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(sig, &sa, NULL);
raise(sig);
// This shouldn't fail, but check it anyway.
if (sigaction(sig, &sa, NULL) == 0)
raise(sig);
// We shouldn't get here, but just in case we do,
// make main() exit with E_ERROR.
set_exit_status(E_ERROR);
#endif
}