[PATCH] fix Mod-C and eliminate redundant shell process

From: Greg Reagle <greg.reagle_AT_umbc.edu>
Date: Tue, 24 Nov 2015 09:28:26 -0500

---
 dvtm.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/dvtm.c b/dvtm.c
index e337061..15ec121 100644
--- a/dvtm.c
+++ b/dvtm.c
_AT_@ -989,14 +989,25 @@ static char *getcwd_by_pid(Client *c) {
 
 static void
 create(const char *args[]) {
-	const char *cmd = (args && args[0]) ? args[0] : shell;
-	const char *pargs[] = { shell, "-c", cmd, NULL };
+	const char *cmd;
+	const char *pargs[4];
 	char buf[8], *cwd = NULL;
 	const char *env[] = {
 		"DVTM_WINDOW_ID", buf,
 		NULL
 	};
 
+	if (args && args[0]) {
+		cmd = args[0];
+		pargs[0] = shell;
+		pargs[1] = "-c";
+		pargs[2] = cmd;
+		pargs[3] = NULL;
+	} else {
+		cmd = shell;
+		pargs[0] = cmd;
+		pargs[1] = NULL;
+	}
 	Client *c = calloc(1, sizeof(Client));
 	if (!c)
 		return;
-- 
1.9.1
--------------000401040206010700030407--
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Tue Nov 24 2015 - 18:36:10 CET