mirror of
https://github.com/FEX-Emu/FEX.git
synced 2025-02-15 12:28:36 +00:00
Tools: Fixes usage of waitpid in the face of EINTR
waitpid can return early if interrupted due to EINTR. Loop on this case and try again.
This commit is contained in:
parent
90f7937146
commit
aa017116b3
@ -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]);
|
||||
|
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user