-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Child process doesn't terminate if execvp fails #84
Comments
Hi @Voxel07, Thank you for raising this issue. We will investigate and add a fix in our code. |
This was
linked to
pull requests
Feb 4, 2022
Thank you for your contributions @wasabii and @Voxel07. The fix was included with the 0.8.0 release. It is mentioned in the CHANGELOG.md and release notes under |
--- a/src/utils/process_utils/src/process_utils.cpp
+++ b/src/utils/process_utils/src/process_utils.cpp
@@ -80,11 +80,11 @@ int ADUC_LaunchChildProcess(const std::string& command, std::vector<std::string>
// The exec() functions only return if an error has occurred.
// The return value is -1, and errno is set to indicate the error.
- int ret = execvp(command.c_str(), &argv[0]);
+ int status = execvp(command.c_str(), &argv[0]);
- fprintf(stderr, "execvp failed, ret %d, error %d\n", ret, errno);
+ fprintf(stderr, "execvp failed, returned %d, error %d\n", status, errno);
- return ret;
+ _exit(EXIT_FAILURE);
}
close(filedes[WRITE_END]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In process_utils.cpp at L80, the child process should not return the execvp value but exit with it.
return ret;
should be_exit(ret);
Otherwise, if the exec command fails, the child process will not be terminated and continue to run the main process code.
Question return or exit
Question _exit or exit
Log Snipped:
The text was updated successfully, but these errors were encountered: