Changeset 90742 in vbox for trunk/src/VBox/HostDrivers/adpctl/VBoxNetAdpCtl.cpp
- Timestamp:
- Aug 19, 2021 12:44:22 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/adpctl/VBoxNetAdpCtl.cpp
r82968 r90742 426 426 return EXIT_FAILURE; 427 427 428 int rc = EXIT_ SUCCESS;428 int rc = EXIT_FAILURE; /* o/~ hope for the best, expect the worst */ 429 429 pid_t childPid = fork(); 430 430 switch (childPid) 431 431 { 432 432 case -1: /* Something went wrong. */ 433 perror("fork() failed"); 434 rc = EXIT_FAILURE; 433 perror("fork"); 435 434 break; 435 436 436 case 0: /* Child process. */ 437 437 if (execve(argv[0], argv, pEnv) == -1) 438 rc = EXIT_FAILURE; 438 { 439 perror("execve"); 440 exit(EXIT_FAILURE); 441 /* NOTREACHED */ 442 } 439 443 break; 444 440 445 default: /* Parent process. */ 441 waitpid(childPid, &rc, 0); 446 { 447 int status; 448 pid_t waited = waitpid(childPid, &status, 0); 449 if (waited == childPid) /* likely*/ 450 { 451 if (WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS) 452 rc = EXIT_SUCCESS; 453 } 454 else if (waited == (pid_t)-1) 455 { 456 perror("waitpid"); 457 } 458 else 459 { 460 /* should never happen */ 461 fprintf(stderr, "waitpid: unexpected pid %lld\n", 462 (long long int)waited); 463 } 442 464 break; 465 } 443 466 } 444 467
Note:
See TracChangeset
for help on using the changeset viewer.