Skip to contentSkip to conversation

tst_cmd: Fix exit in search for program in $PATH

PATCH New Cyril Hrubis 1 participant 1 message Apr 17, 2020 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tst_cmd: Fix exit in search for program in $PATH

The check is executed before fork() so we have to do return instead of exit() otherwise we exit the library process.

Fixes 105d283bc ("lib/tst_cmd_*(): Search for program in $PATH")
---
 lib/tst_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/tst_cmd.c +1 -1
index 3a90d1a5d..4b67d4b31 100644
@@ -64,7 +64,7 @@ int tst_cmd_fds_(void (cleanup_fn)(void),
 			tst_brkm(TCONF, cleanup_fn, "Couldn't find '%s' in $PATH at %s:%d", argv[0],
 				 __FILE__, __LINE__);
 		else
-			_exit(255);
+			return 255;
 	}
 
 	pid_t pid = vfork();
Signature · 1 line
2.24.1