Changeset 4231
- Timestamp:
- 07/30/08 01:36:58 (5 years ago)
- Files:
-
- 1 modified
-
rat/trunk/process.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rat/trunk/process.c
r4226 r4231 94 94 debug_msg("Running as root? PATH unmodified\n"); 95 95 } 96 /* some glibc versions have issues with malloc/free when used inside or 97 in some cases outside a fork/exec, so we now use a args[64] array instead of 98 xmalloc'ing it. In the unlikely event the array needs to hold more 99 command-line arguments, print a error message */ 100 if ((2 * num_tokens) + argc + 4 >= 64) { 101 fprintf(stderr, "Exceeded max of %i command-line arguments\n", 102 64 - (2 * num_tokens) + 4); 103 exit(1); 104 } 96 105 /* Fork off the sub-process... */ 97 106 *pid = fork(); … … 100 109 abort(); 101 110 } else if (*pid == 0) { 102 char * *args = xmalloc((2 * num_tokens) + argc + 4);111 char *args[64]; 103 112 int numargs=0; 104 113 … … 115 124 args[numargs++] = NULL; 116 125 execvp( proc_name, args ); 117 126 118 127 perror("Cannot execute subprocess"); 119 xfree(args); 120 /* Note: this MUST NOT be exit() or abort(), since they affect the standard */ 121 /* IO channels in the parent process (fork duplicates file descriptors, but */ 128 /* Note: this MUST NOT be exit() or abort(), since they affect the standard */ 129 /* IO channels in the parent process (fork duplicates file descriptors, but */ 122 130 /* they still point to the same underlying file). */ 123 131 _exit(1);
