From f5a7492a113ddf9144eea380c25958c0f8bf79f4 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 5 Sep 2012 17:09:23 +0200 Subject: [PATCH] Bugfix: Use _exit() instead of exit to avoid calling atexit functions (Thanks f8l) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- src/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.c b/src/util.c index d337963e..8273e0cf 100644 --- a/src/util.c +++ b/src/util.c @@ -91,7 +91,7 @@ void exec_i3_utility(char *name, char *argv[]) { char buffer[BUFSIZ]; if (readlink("/proc/self/exe", buffer, BUFSIZ) == -1) { warn("could not read /proc/self/exe"); - exit(1); + _exit(1); } dir = dirname(buffer); sasprintf(&migratepath, "%s/%s", dir, name); @@ -100,7 +100,7 @@ void exec_i3_utility(char *name, char *argv[]) { #endif warn("Could not start %s", name); - exit(2); + _exit(2); } /* -- 2.39.5