Changeset 4573 for trunk/Ohana/src/opihi/pclient/job.c
- Timestamp:
- Jul 16, 2005, 6:01:28 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pclient/job.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pclient/job.c
r4450 r4573 3 3 int job (int argc, char **argv) { 4 4 5 int pid, status; 5 int i, pid, status; 6 char **targv; 6 7 7 8 if (argc < 2) { … … 20 21 if (pipe (child_stdout_fd) < 0) goto pipe_error; 21 22 if (pipe (child_stderr_fd) < 0) goto pipe_error; 23 24 /* need to define arg list with NULL termination */ 25 ALLOCATE (targv, char *, argc); 26 for (i = 1; i < argc; i++) { 27 targv[i-1] = strcreate (argv[i]); 28 } 29 targv[i] = 0; 22 30 23 31 pid = fork (); … … 39 47 setvbuf (stdout, (char *) NULL, _IONBF, BUFSIZ); 40 48 setvbuf (stderr, (char *) NULL, _IONBF, BUFSIZ); 41 /* fprintf (stderr, "child is spawned, executing command\n"); */42 /* note that this message comes out on the other side of the stderr pipe */43 49 44 50 /* exec job */ 45 status = execvp ( argv[1], &argv[1]);51 status = execvp (targv[0], targv); 46 52 fprintf (stderr, "error starting child process: %d\n", status); 47 53 exit (1);
Note:
See TracChangeset
for help on using the changeset viewer.
