Get rid of atexit()
This was a bad idea in a forking model where exit() is called from children.
This commit is contained in:
parent
0fed1d5bd2
commit
3373992ca5
1 changed files with 3 additions and 1 deletions
4
quark.c
4
quark.c
|
@ -916,14 +916,17 @@ getusock(char *udsname, uid_t uid, gid_t gid)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listen(insock, SOMAXCONN) < 0) {
|
if (listen(insock, SOMAXCONN) < 0) {
|
||||||
|
cleanup();
|
||||||
die("%s: listen: %s\n", argv0, strerror(errno));
|
die("%s: listen: %s\n", argv0, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chmod(udsname, sockmode) < 0) {
|
if (chmod(udsname, sockmode) < 0) {
|
||||||
|
cleanup();
|
||||||
die("%s: chmod: %s\n", argv0, strerror(errno));
|
die("%s: chmod: %s\n", argv0, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chown(udsname, uid, gid) < 0) {
|
if (chown(udsname, uid, gid) < 0) {
|
||||||
|
cleanup();
|
||||||
die("%s: chown: %s\n", argv0, strerror(errno));
|
die("%s: chown: %s\n", argv0, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1002,7 +1005,6 @@ main(int argc, char *argv[])
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
atexit(cleanup);
|
|
||||||
if (signal(SIGINT, sigcleanup) == SIG_ERR) {
|
if (signal(SIGINT, sigcleanup) == SIG_ERR) {
|
||||||
fprintf(stderr, "%s: signal: Failed to handle SIGINT\n",
|
fprintf(stderr, "%s: signal: Failed to handle SIGINT\n",
|
||||||
argv0);
|
argv0);
|
||||||
|
|
Loading…
Reference in a new issue