summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-11-01 14:28:46 +0200
committerTimo Teräs <timo.teras@iki.fi>2021-11-03 15:37:10 +0200
commitd8212658653ad7cb1e220635b6dbd92923a60520 (patch)
tree7107b5a4320f1ea2b0fbab53ec464ff0b967bf80 /src
parent6941aac4c6379bebe7ee0a759f4a4b6df03c3984 (diff)
downloadapk-tools-d8212658653ad7cb1e220635b6dbd92923a60520.tar.gz
apk-tools-d8212658653ad7cb1e220635b6dbd92923a60520.tar.bz2
apk-tools-d8212658653ad7cb1e220635b6dbd92923a60520.tar.xz
apk-tools-d8212658653ad7cb1e220635b6dbd92923a60520.zip
db, extract: handle waitpid returning EINTR
Diffstat (limited to 'src')
-rw-r--r--src/app_extract.c4
-rw-r--r--src/database.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/app_extract.c b/src/app_extract.c
index c2836da..22ef971 100644
--- a/src/app_extract.c
+++ b/src/app_extract.c
@@ -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;
diff --git a/src/database.c b/src/database.c
index f8dd440..3841464 100644
--- a/src/database.c
+++ b/src/database.c
@@ -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;