canlogserver: Fix termination after signal
Withpull/423/headf45de1b782, we've removed unsafe function exit(3) from the signal handler. But that made canlogserver's accept(3)ing process not exit; It unconditionally keeps running with EINTR. Check the variable "running" when signaled and exit with an appropriate error code. Fixes:f45de1b782("canlogserver: Follow Bash exit status when signaled") Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
parent
c8fef7d60d
commit
0d276a105d
|
|
@ -306,6 +306,15 @@ int main(int argc, char **argv)
|
||||||
perror("accept");
|
perror("accept");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
else if ((errno == EINTR) && !running) {
|
||||||
|
close(socki);
|
||||||
|
if (signal_num) {
|
||||||
|
return 128 + signal_num;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<currmax; i++) {
|
for (i=0; i<currmax; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue