Exit if changing to root directory fails

This commit is contained in:
Marc André Tanner 2020-04-19 12:59:52 +02:00
parent 32a839d76a
commit 5bf6b3178b
1 changed files with 2 additions and 1 deletions

View File

@ -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) {