db, extract: handle waitpid returning EINTR

cute-signatures
Timo Teräs 2021-11-01 14:28:46 +02:00
parent 6941aac4c6
commit d821265865
2 changed files with 3 additions and 3 deletions

View File

@ -72,7 +72,7 @@ static int uvol_run(struct apk_ctx *ac, char *action, const char *volname, char
apk_err(out, "%s: uvol exec error: %s", volname, apk_error_str(r));
return r;
}
waitpid(pid, &status, 0);
while (waitpid(pid, &status, 0) < 0 && errno == EINTR);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
apk_err(out, "%s: uvol exited with error %d", volname, WEXITSTATUS(status));
return -APKE_UVOL;
@ -109,7 +109,7 @@ static int uvol_extract(struct apk_ctx *ac, const char *volname, char *arg1, off
return r;
}
waitpid(pid, &status, 0);
while (waitpid(pid, &status, 0) < 0 && errno == EINTR);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
apk_err(out, "%s: uvol exited with error %d", volname, WEXITSTATUS(status));
return -APKE_UVOL;

View File

@ -1935,7 +1935,7 @@ int apk_db_run_script(struct apk_database *db, char *fn, char **argv)
execve(fn, argv, environment);
exit(127); /* should not get here */
}
waitpid(pid, &status, 0);
while (waitpid(pid, &status, 0) < 0 && errno == EINTR);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
apk_err(out, "%s: script exited with error %d", basename(fn), WEXITSTATUS(status));
return -1;