mirror of
https://github.com/moparisthebest/pacman
synced 2025-03-01 01:41:52 -05:00
pacman: Correct signal handler comment and refactor
One of the comments for this function is out of sync with the code. Since the code exhibits the more sane behavior of treating SIGINT and SIGHUB the same way (by not exiting pacman when there is a commit in flight) we adjust the comment. Given this code flow, the if/else statements can be simplified somewhat as well. Signed-off-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
8dbb80cfe9
commit
fa0c1e1419
@ -301,7 +301,7 @@ static void handler(int signum)
|
|||||||
"Please submit a full bug report with --debug if appropriate.\n";
|
"Please submit a full bug report with --debug if appropriate.\n";
|
||||||
xwrite(err, msg, strlen(msg));
|
xwrite(err, msg, strlen(msg));
|
||||||
exit(signum);
|
exit(signum);
|
||||||
} else if(signum == SIGINT || signum == SIGHUP) {
|
} else if(signum != SIGTERM) {
|
||||||
if(signum == SIGINT) {
|
if(signum == SIGINT) {
|
||||||
msg = "\nInterrupt signal received\n";
|
msg = "\nInterrupt signal received\n";
|
||||||
} else {
|
} else {
|
||||||
@ -313,8 +313,8 @@ static void handler(int signum)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* SIGINT: no committing transaction, release it now and then exit pacman
|
/* SIGINT/SIGHUP: no committing transaction, release it now and then exit pacman
|
||||||
* SIGHUP, SIGTERM: release no matter what */
|
* SIGTERM: release no matter what */
|
||||||
alpm_trans_release(config->handle);
|
alpm_trans_release(config->handle);
|
||||||
/* output a newline to be sure we clear any line we may be on */
|
/* output a newline to be sure we clear any line we may be on */
|
||||||
xwrite(out, "\n", 1);
|
xwrite(out, "\n", 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user