[hackers] [quark] Get rid of atexit() || Quentin Rameau
commit 3373992ca5b7ea51900a4a821379235b20e308b8
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Mon Jul 24 00:38:17 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Mon Jul 24 16:49:24 2017 +0200
Get rid of atexit()
This was a bad idea in a forking model where exit() is called from
children.
diff --git a/quark.c b/quark.c
index 4e8c4ef..fd78c1d 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -916,14 +916,17 @@ getusock(char *udsname, uid_t uid, gid_t gid)
}
if (listen(insock, SOMAXCONN) < 0) {
+ cleanup();
die("%s: listen: %s\n", argv0, strerror(errno));
}
if (chmod(udsname, sockmode) < 0) {
+ cleanup();
die("%s: chmod: %s\n", argv0, strerror(errno));
}
if (chown(udsname, uid, gid) < 0) {
+ cleanup();
die("%s: chown: %s\n", argv0, strerror(errno));
}
_AT_@ -1002,7 +1005,6 @@ main(int argc, char *argv[])
usage();
}
- atexit(cleanup);
if (signal(SIGINT, sigcleanup) == SIG_ERR) {
fprintf(stderr, "%s: signal: Failed to handle SIGINT\n",
argv0);
Received on Mon Jul 24 2017 - 16:49:36 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 24 2017 - 17:03:00 CEST