[svn:parrot] r38727 - trunk/src/io

NotFound at svn.parrot.org NotFound at svn.parrot.org
Tue May 12 22:16:06 UTC 2009


Author: NotFound
Date: Tue May 12 22:16:06 2009
New Revision: 38727
URL: https://trac.parrot.org/parrot/changeset/38727

Log:
[cage] some cleaning of Parrot_io_open_pipe_unix

Modified:
   trunk/src/io/unix.c

Modified: trunk/src/io/unix.c
==============================================================================
--- trunk/src/io/unix.c	Tue May 12 21:58:38 2009	(r38726)
+++ trunk/src/io/unix.c	Tue May 12 22:16:06 2009	(r38727)
@@ -672,8 +672,19 @@
 
     /* Child - exec process */
     if (pid == 0) {
+        /* See above comments */
+        #if 0
         char *argv[10], *p, *c, *cmd, *orig_cmd;
         int   n;
+        #else
+        char * argv[10], *orig_cmd;
+
+        /* C strings for the execv call defined that way to avoid
+         * const problems without copying them.
+         */
+        static char auxarg0 [] = "/bin/sh";
+        static char auxarg1 [] = "-c";
+        #endif
 
         if (flags & PIO_F_WRITE) {
             /* the other end is writing - we read from the pipe */
@@ -697,7 +708,7 @@
 
         /*******************************************************
          *     THIS IS A QUICK TEST IMPLEMENTATION
-         * Thus the ifdef'ed out code is not deleted yet
+         * Thus the if'ed out code is not deleted yet
          * TT #661
          *******************************************************
          */
@@ -719,10 +730,10 @@
         execv(cmd, argv);       /* XXX use execvp ? */
         #else
 
-        orig_cmd = cmd = Parrot_str_to_cstring(interp, command);
-        argv [0] = "/bin/sh";
-        argv [1] = "-c";
-        argv [2] = cmd;
+        orig_cmd = Parrot_str_to_cstring(interp, command);
+        argv [0] = auxarg0;
+        argv [1] = auxarg1;
+        argv [2] = orig_cmd;
         argv [3] = NULL;
         execv(argv [0], argv);
 


More information about the parrot-commits mailing list