[pacman-dev] [PATCH 1/4] Revert refactoring in fa0c1e14
This will cause the code to break as soon as we handle another signal such as SIGWINCH... Signed-off-by: Allan McRae <allan@archlinux.org> --- Well... that didn't last long. src/pacman/pacman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index e8c5f9e..baa0485 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -301,7 +301,7 @@ static void handler(int signum) "Please submit a full bug report with --debug if appropriate.\n"; xwrite(err, msg, strlen(msg)); exit(signum); - } else if(signum != SIGTERM) { + } else if(signum == SIGINT || signum == SIGHUP) { if(signum == SIGINT) { msg = "\nInterrupt signal received\n"; } else { -- 2.0.1
On Sun, Jun 29, 2014 at 11:27:31AM +1000, Allan McRae wrote:
This will cause the code to break as soon as we handle another signal such as SIGWINCH...
Signed-off-by: Allan McRae <allan@archlinux.org> ---
Well... that didn't last long.
Seems to me the thing to do is to declare a mapping between signum and handler, rather than declaring a signal handler for everything, and then littering the logic with if/else. I can send a patch on top of my SIGWINCH patch...
src/pacman/pacman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index e8c5f9e..baa0485 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -301,7 +301,7 @@ static void handler(int signum) "Please submit a full bug report with --debug if appropriate.\n"; xwrite(err, msg, strlen(msg)); exit(signum); - } else if(signum != SIGTERM) { + } else if(signum == SIGINT || signum == SIGHUP) { if(signum == SIGINT) { msg = "\nInterrupt signal received\n"; } else { -- 2.0.1
On 29/06/14 11:45, Dave Reisner wrote:
On Sun, Jun 29, 2014 at 11:27:31AM +1000, Allan McRae wrote:
This will cause the code to break as soon as we handle another signal such as SIGWINCH...
Signed-off-by: Allan McRae <allan@archlinux.org> ---
Well... that didn't last long.
Seems to me the thing to do is to declare a mapping between signum and handler, rather than declaring a signal handler for everything, and then littering the logic with if/else.
I can send a patch on top of my SIGWINCH patch...
Sure. A
On Sat, Jun 28, 2014 at 09:45:05PM -0400, Dave Reisner wrote:
On Sun, Jun 29, 2014 at 11:27:31AM +1000, Allan McRae wrote:
This will cause the code to break as soon as we handle another signal such as SIGWINCH...
Signed-off-by: Allan McRae <allan@archlinux.org> ---
Well... that didn't last long.
At least the comment is still fixed... :P
Seems to me the thing to do is to declare a mapping between signum and handler, rather than declaring a signal handler for everything, and then littering the logic with if/else.
I think that is the right way forward as well. Cheers, Silvan
participants (3)
-
Allan McRae
-
Dave Reisner
-
Silvan Jegen