Quiet string literal constness warnings
authorPhil Miller <mille121@illinois.edu>
Fri, 6 May 2011 22:18:40 +0000 (17:18 -0500)
committerPhil Miller <mille121@illinois.edu>
Fri, 6 May 2011 22:18:40 +0000 (17:18 -0500)
Since we're about to exec, it's safe to waste a bit of memory making
mutable copies of some literal strings.

src/util/ckdll_system.C

index a2b40c1f4d04a657810df9d3c21c759f8c252640..8697f14af7df13a8c7dd2188c2fcd07209b75b10 100644 (file)
@@ -17,8 +17,8 @@ int CkSystem (const char *command) {
        return -1;
    if (pid == 0) { /*Child: exec the shell*/
                char *argv[4];
-               argv[0] = "sh";
-               argv[1] = "-c";
+               argv[0] = strdup("sh");
+               argv[1] = strdup("-c");
                argv[2] = (char *)command;
                argv[3] = 0;
                execv("/bin/sh", argv);