aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrumeet <yuuta@yuuta.moe>2022-12-23 20:27:34 -0800
committerTrumeet <yuuta@yuuta.moe>2022-12-23 20:27:34 -0800
commit22574b3ce2786c44e76fcf3bfb41370d3cf5ce97 (patch)
tree4d70aaeb1e9824dfac62225c806c4af1bef8fd2a
parent6c02deb271622b4f14ad53a19aa26b1c194f43da (diff)
downloadsecdesk-22574b3ce2786c44e76fcf3bfb41370d3cf5ce97.tar
secdesk-22574b3ce2786c44e76fcf3bfb41370d3cf5ce97.tar.gz
secdesk-22574b3ce2786c44e76fcf3bfb41370d3cf5ce97.tar.bz2
secdesk-22574b3ce2786c44e76fcf3bfb41370d3cf5ce97.zip
Fix ^C cannot exit properly
-rw-r--r--main.c9
-rw-r--r--sd.c2
2 files changed, 8 insertions, 3 deletions
diff --git a/main.c b/main.c
index 4652583..a5f091b 100644
--- a/main.c
+++ b/main.c
@@ -43,11 +43,16 @@ int main(int argc, char **argv) {
setbuf(stdout, NULL);
a_env.pid = getppid();
signal(SIGHUP, SIG_IGN);
- if (sd_setup()) {
+ int r = sd_setup();
+ if (r == -1) {
+ sd_cleanup();
+ return 13;
+ }
+ if (r) {
sd_cleanup();
return main_consent(0);
} else {
- int r = main_consent(1);
+ r = main_consent(1);
sd_cleanup();
return r;
}
diff --git a/sd.c b/sd.c
index c987df3..c9e919b 100644
--- a/sd.c
+++ b/sd.c
@@ -137,7 +137,7 @@ int sd_setup(void) {
}
case SIGINT:
case SIGTERM: {
- exit(13);
+ return -1;
}
default: {
/* Consider insecure.