Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0ea1f2a

Browse files
committed
Report success when Windows kill() emulation signals an exiting process.
This is consistent with the POSIX verdict that kill() shall not reportESRCH for a zombie process. Back-patch to 9.0 (all supported versions).Test code from commitd7cdf6e dependson it, and log messages about kill() reporting "Invalid argument" willcease to appear for this not-unexpected condition.
1 parent31f9bbf commit0ea1f2a

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

‎src/port/kill.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,28 @@ pgkill(int pid, int sig)
7070
return0;
7171
}
7272

73-
if (GetLastError()==ERROR_FILE_NOT_FOUND)
74-
errno=ESRCH;
75-
elseif (GetLastError()==ERROR_ACCESS_DENIED)
76-
errno=EPERM;
77-
else
78-
errno=EINVAL;
79-
return-1;
73+
switch (GetLastError())
74+
{
75+
caseERROR_BROKEN_PIPE:
76+
caseERROR_BAD_PIPE:
77+
78+
/*
79+
* These arise transiently as a process is exiting. Treat them
80+
* like POSIX treats a zombie process, reporting success.
81+
*/
82+
return0;
83+
84+
caseERROR_FILE_NOT_FOUND:
85+
/* pipe fully gone, so treat the process as gone */
86+
errno=ESRCH;
87+
return-1;
88+
caseERROR_ACCESS_DENIED:
89+
errno=EPERM;
90+
return-1;
91+
default:
92+
errno=EINVAL;/* unexpected */
93+
return-1;
94+
}
8095
}
8196

8297
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp