Changeset 4552
- Timestamp:
- 07/23/08 10:36:18 (5 years ago)
- File:
-
- 1 edited
-
developers/zecke/app_restarter/app_restarter.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
developers/zecke/app_restarter/app_restarter.c
r4549 r4552 197 197 * On any kind of exit ask the user to restart 198 198 */ 199 int fork_and_exec( char* file,int argc, char** argv)199 int fork_and_exec(int argc, char** argv) 200 200 { 201 201 pid_t pid = vfork(); 202 202 203 203 if (pid == 0) { 204 execvp( file, argv);205 fprintf(stderr, "Failed to launch: %s\n", file);204 execvp(argv[0], argv); 205 fprintf(stderr, "Failed to launch: %s\n", argv[0]); 206 206 _exit(-1); 207 207 } else { 208 208 int status; 209 209 210 fprintf(stderr, "Waiting for pid: %d\n", pid); 211 210 212 /* wait for the process to die */ 211 213 while (waitpid(pid, &status, 0) != pid); … … 233 235 234 236 /* Create a list for execvp with a sentinel */ 235 int commands = argc- 3;237 int commands = argc-2; 236 238 char** command_arguments = (char**) malloc(sizeof(char*)*(commands+1)); 237 239 for (i = 0; i < commands; ++i) … … 240 242 241 243 for (;;) { 242 int status = fork_and_exec( argv[2],commands, command_arguments);244 int status = fork_and_exec(commands, command_arguments); 243 245 handle_crash(status, argv[1]); 244 246 }
Note: See TracChangeset
for help on using the changeset viewer.
