From: Andre Noll Date: Mon, 25 Jun 2012 18:48:53 +0000 (+0200) Subject: Fix check for return value of catch_signal(). X-Git-Tag: v1.0.0~23 X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=commitdiff_plain;h=c6efe1f82dce725cbf20ca56a6d9e4e493351acd;ds=sidebyside Fix check for return value of catch_signal(). Commit 2d7a4d61 made adu's signal handling portable by switching from signal() to sigaction() for installing signal handlers. This commit added the new function catch_signal() which returns the return value of the underlying call to sigaction(), i.e. zero on success, and -1 on errors. However, embarrassingly enough, one caller of catch_signal() still checked this return value against SIG_ERR, which is the value that is returned from signal() on errors. Fix this bug by testing the return value against zero. --- diff --git a/adu.c b/adu.c index 0bb5aad..6d4780e 100644 --- a/adu.c +++ b/adu.c @@ -181,7 +181,7 @@ static int init_signals(void) return -E_SIGACTION; if (catch_signal(SIGTERM) < 0) return -E_SIGACTION; - if (catch_signal(SIGPIPE) == SIG_ERR) + if (catch_signal(SIGPIPE) < 0) return -E_SIGACTION; return 1; }