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

Commitc76a98e

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 parent48aa003 commitc76a98e

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
@@ -50,13 +50,28 @@ pgkill(int pid, int sig)
5050
return0;
5151
}
5252

53-
if (GetLastError()==ERROR_FILE_NOT_FOUND)
54-
errno=ESRCH;
55-
elseif (GetLastError()==ERROR_ACCESS_DENIED)
56-
errno=EPERM;
57-
else
58-
errno=EINVAL;
59-
return-1;
53+
switch (GetLastError())
54+
{
55+
caseERROR_BROKEN_PIPE:
56+
caseERROR_BAD_PIPE:
57+
58+
/*
59+
* These arise transiently as a process is exiting. Treat them
60+
* like POSIX treats a zombie process, reporting success.
61+
*/
62+
return0;
63+
64+
caseERROR_FILE_NOT_FOUND:
65+
/* pipe fully gone, so treat the process as gone */
66+
errno=ESRCH;
67+
return-1;
68+
caseERROR_ACCESS_DENIED:
69+
errno=EPERM;
70+
return-1;
71+
default:
72+
errno=EINVAL;/* unexpected */
73+
return-1;
74+
}
6075
}
6176

6277
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp