From aa107956f92812d20b3198f4bac1ec03e5adddb6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Jan 2018 23:55:03 +0530 Subject: [PATCH] ... --- kitty/child.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/child.c b/kitty/child.c index 9fea88622..d5a84c975 100644 --- a/kitty/child.c +++ b/kitty/child.c @@ -36,7 +36,7 @@ spawn(PyObject *self UNUSED, PyObject *args) { if (pid == 0) { // child // We cannot use malloc before exec() as it might deadlock if a thread in the parent process is in the middle of a malloc itself - if (chdir(cwd) != 0) if (chdir("/") != 0) {}; // ignore failure to chdir to / + if (chdir(cwd) != 0) { if (chdir("/") != 0) {} }; // ignore failure to chdir to / if (setsid() == -1) { perror("setsid() in child process failed"); exit(EXIT_FAILURE); } if (dup2(slave, 1) == -1) { perror("dup2() failed for fd number 1"); exit(EXIT_FAILURE); } if (dup2(slave, 2) == -1) { perror("dup2() failed for fd number 2"); exit(EXIT_FAILURE); }