Merge pull request #3081 from Sonicadvance1/fix_waitpid

Tools: Fixes usage of waitpid in the face of EINTR
This commit is contained in:
Mai authored and GitHub committed 2023-09-12 19:35:05 -04:00
commit dda5861bdd
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -149,7 +149,7 @@ namespace Exec {
}
else {
int32_t Status{};
waitpid(pid, &Status, 0);
while (waitpid(pid, &Status, 0) == -1 && errno == EINTR);
if (WIFEXITED(Status)) {
return (int8_t)WEXITSTATUS(Status);
}
@@ -192,7 +192,7 @@ namespace Exec {
}
int32_t Status{};
waitpid(pid, &Status, 0);
while (waitpid(pid, &Status, 0) == -1 && errno == EINTR);
if (WIFEXITED(Status)) {
// Return what we've read
close(fd[0]);
+2 -2
View File
@@ -157,7 +157,7 @@ namespace SquashFS {
// Parent
// Wait for the child to exit
// This will happen with execvpe of squashmount or exit on failure
waitpid(pid, nullptr, 0);
while (waitpid(pid, nullptr, 0) == -1 && errno == EINTR);
// Check the child pipe for messages
pollfd PollFD;
@@ -217,7 +217,7 @@ namespace SquashFS {
}
else {
// Wait for fusermount to leave
waitpid(pid, nullptr, 0);
while (waitpid(pid, nullptr, 0) == -1 && errno == EINTR);
// Remove the mount path
rmdir(MountFolder.c_str());