From 5bf6b3178b64b60d15139f7be0031e186d3cf378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 19 Apr 2020 12:59:52 +0200 Subject: [PATCH] Exit if changing to root directory fails --- abduco.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/abduco.c b/abduco.c index 84ddb9a..792e5f5 100644 --- a/abduco.c +++ b/abduco.c @@ -463,7 +463,8 @@ static bool create_session(const char *name, char * const argv[]) { sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, NULL); sigaction(SIGHUP, &sa, NULL); - chdir("/"); + if (chdir("/") == -1) + _exit(EXIT_FAILURE); #ifdef NDEBUG int fd = open("/dev/null", O_RDWR); if (fd != -1) {