Bugfix: Use _exit() instead of exit to avoid calling atexit functions (Thanks f8l)

Basically, this is the same fix as commit 914ca6cf :-/. Once again, we
called exit() instead of _exit(), but this time it lead to a kill(0,
SIGTERM), effectively killing all processes in the i3 process group,
including i3 itself. The cause for the kill(0) is that nagbar_pid is set
to 0 by fork(), signaling we’re in the child process. The cleanup
handler only checks for nagbar_pid being -1 as a special value, however.
This commit is contained in:
Michael Stapelberg 2012-09-05 17:09:23 +02:00
parent ada6af4244
commit f5a7492a11

View File

@ -91,7 +91,7 @@ void exec_i3_utility(char *name, char *argv[]) {
char buffer[BUFSIZ]; char buffer[BUFSIZ];
if (readlink("/proc/self/exe", buffer, BUFSIZ) == -1) { if (readlink("/proc/self/exe", buffer, BUFSIZ) == -1) {
warn("could not read /proc/self/exe"); warn("could not read /proc/self/exe");
exit(1); _exit(1);
} }
dir = dirname(buffer); dir = dirname(buffer);
sasprintf(&migratepath, "%s/%s", dir, name); sasprintf(&migratepath, "%s/%s", dir, name);
@ -100,7 +100,7 @@ void exec_i3_utility(char *name, char *argv[]) {
#endif #endif
warn("Could not start %s", name); warn("Could not start %s", name);
exit(2); _exit(2);
} }
/* /*