summaryrefslogtreecommitdiffstats
path: root/src/shared/async.c
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2023-07-10 19:46:29 +0200
committerMike Yuan <me@yhndnzj.com>2023-07-11 06:08:09 +0200
commit898f4da326051addf1ec17887e6b1737d0dab2ec (patch)
tree3c1ba510478a4781e1f949d11954bfc85ef922b2 /src/shared/async.c
parentshared/async: prefix process name with sd- (diff)
downloadsystemd-898f4da326051addf1ec17887e6b1737d0dab2ec.tar.xz
systemd-898f4da326051addf1ec17887e6b1737d0dab2ec.zip
shared/async: don't use WEXITED for waitpid()
Follow-up for c26d7837bb08508c8d906d849dff8f1bc465063e waitpid() doesn't support WEXITED and returns -1 (EINVAL), which results in the intermediate close process not getting reaped. Fixes https://github.com/systemd/systemd/issues/26744#issuecomment-1628240782
Diffstat (limited to 'src/shared/async.c')
-rw-r--r--src/shared/async.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/shared/async.c b/src/shared/async.c
index 1cf1936d4b..6af63d7a9c 100644
--- a/src/shared/async.c
+++ b/src/shared/async.c
@@ -103,10 +103,9 @@ int asynchronous_close(int fd) {
*
* We usually prefer calling waitid(), but before kernel 4.7 it didn't support __WCLONE while
* waitpid() did. Hence let's use waitpid() here, it's good enough for our purposes here. */
- for (;;) {
- if (waitpid(pid, NULL, WEXITED|__WCLONE) >= 0 || errno != EINTR)
+ for (;;)
+ if (waitpid(pid, NULL, __WCLONE) >= 0 || errno != EINTR)
break;
- }
}
return -EBADF; /* return an invalidated fd */