shared/async: don't use WEXITED for waitpid()

Follow-up for c26d7837bb

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
This commit is contained in:
Mike Yuan
2023-07-11 12:08:09 +08:00
parent f7b1d37c77
commit 898f4da326
+2 -3
View File
@@ -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 */