We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c84586d + 7687bc1 commit 5c7ade3Copy full SHA for 5c7ade3
stdlib/tools/swift-reflection-test/swift-reflection-test.c
@@ -643,8 +643,15 @@ int doDumpHeapInstance(const char *BinaryFilename) {
643
close(PipeMemoryReader_getParentReadFD(&Pipe));
644
dup2(PipeMemoryReader_getChildReadFD(&Pipe), STDIN_FILENO);
645
dup2(PipeMemoryReader_getChildWriteFD(&Pipe), STDOUT_FILENO);
646
- _execv(BinaryFilename, NULL);
647
- exit(EXIT_SUCCESS);
+
+ char *const argv[] = {strdup(BinaryFilename), NULL};
648
+ int r = _execv(BinaryFilename, argv);
649
+ int status = EXIT_SUCCESS;
650
+ if (r == -1) {
651
+ perror("child process");
652
+ status = EXIT_FAILURE;
653
+ }
654
+ exit(status);
655
}
656
default: { // Parent
657
close(PipeMemoryReader_getChildReadFD(&Pipe));
0 commit comments