tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH 2/6] script.c: use sh -c directly instead of system(3)



---
 script.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/script.c b/script.c
index 209505c..1b42a3b 100644
--- a/script.c
+++ b/script.c
@@ -293,12 +293,12 @@ doshell(const char *command)
 		if (shell == NULL)
 			shell = _PATH_BSHELL;
 		execl(shell, shell, "-i", NULL);
-		warn("execl `%s'", shell);
 	} else {
-		if (system(command) == -1)
-			warn("system `%s'", command);
+		shell = _PATH_BSHELL;
+		execl(shell, shell, "-c", command, (char *)NULL);
 	}
 
+	warn("execl `%s'", shell);
 	fail();
 }
 
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index