mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
Merge pull request #28348 from YHNdnzj/async-close-waitpid
shared/async: don't use WEXITED for waitpid()
This commit is contained in:
@@ -41,7 +41,7 @@ int asynchronous_sync(pid_t *ret_pid) {
|
||||
static int close_func(void *p) {
|
||||
unsigned v = PTR_TO_UINT(p);
|
||||
|
||||
(void) prctl(PR_SET_NAME, (unsigned long*) "(close)");
|
||||
(void) prctl(PR_SET_NAME, (unsigned long*) "(sd-close)");
|
||||
|
||||
/* Note: 💣 This function is invoked in a child process created via glibc's clone() wrapper. In such
|
||||
* children memory allocation is not allowed, since glibc does not release malloc mutexes in
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user