diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-09-28 14:33:16 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-09-29 12:21:53 +0200 |
commit | 8534be076c73603d58d54634b5d3e78bd5d96ec0 (patch) | |
tree | 626bb68422a29bf46c6827225ac511f2b63cb7da /passt.c | |
parent | 8a19f368642571bc68474b12c359a5334131b793 (diff) | |
download | passt-8534be076c73603d58d54634b5d3e78bd5d96ec0.tar passt-8534be076c73603d58d54634b5d3e78bd5d96ec0.tar.gz passt-8534be076c73603d58d54634b5d3e78bd5d96ec0.tar.bz2 passt-8534be076c73603d58d54634b5d3e78bd5d96ec0.tar.lz passt-8534be076c73603d58d54634b5d3e78bd5d96ec0.tar.xz passt-8534be076c73603d58d54634b5d3e78bd5d96ec0.tar.zst passt-8534be076c73603d58d54634b5d3e78bd5d96ec0.zip |
Catch failures when installing signal handlers
Stop ignoring the return codes from sigaction() and signal(). Unlikely to
happen in practice, but if it ever did it could lead to really hard to
debug problems. So, take clang-tidy's advice and check for errors here.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.c')
-rw-r--r-- | passt.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -201,8 +201,10 @@ int main(int argc, char **argv) name = basename(argv0); if (strstr(name, "pasta")) { sa.sa_handler = pasta_child_handler; - sigaction(SIGCHLD, &sa, NULL); - signal(SIGPIPE, SIG_IGN); + if (sigaction(SIGCHLD, &sa, NULL) || signal(SIGPIPE, SIG_IGN)) { + err("Couldn't install signal handlers"); + exit(EXIT_FAILURE); + } c.mode = MODE_PASTA; log_name = "pasta"; |