slb

Sleep on Low Battery
Log | Files | Refs | README | LICENSE

commit 0ba99ca71cf03b641eb4ad6277de7df301bf913c
parent 73a56436691774cc870c393578c577efbb8c26ea
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Wed, 30 Oct 2019 21:16:11 +0100

Exit on fork failure so that the error doesn't get masked

Diffstat:
Mslb.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/slb.c b/slb.c @@ -15,8 +15,10 @@ daemoninit(void) { pid_t p; - if ((p = fork()) == -1) - return -1; + if ((p = fork()) == -1) { + syslog(LOG_DAEMON|LOG_ERR, "fork error for %s: %m", "slb.c"); + exit(1); + } else if (p != 0) exit(0); @@ -62,7 +64,7 @@ main(int argc, char **argv) pid_t p; openlog("slb", LOG_PID | LOG_CONS, LOG_DAEMON); - if (!daemoninit()) + if (daemoninit()) for (;;) { tpow = 0;