From e20b3d59fc91ccf5c5325bb2e5a13b449b199d4a Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Mon, 18 Sep 2023 23:13:41 +0200 Subject: [PATCH] only exec if chdir worked --- Source/NSTask.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/NSTask.m b/Source/NSTask.m index ea8d8663d..cc43df9c5 100644 --- a/Source/NSTask.m +++ b/Source/NSTask.m @@ -1733,7 +1733,11 @@ GSPrivateCheckTasks() (void) close(i); } - (void)chdir(path); + if (0 != chdir(path)) + { + exit(-1); + } + (void)execve(executable, (char**)args, (char**)envl); exit(-1); }