From d8212658653ad7cb1e220635b6dbd92923a60520 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 1 Nov 2021 14:28:46 +0200 Subject: db, extract: handle waitpid returning EINTR --- src/app_extract.c | 4 ++-- src/database.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2