aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--win32/win32.c27
2 files changed, 23 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index f668800812..901e65c675 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Aug 28 17:45:03 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * win32/win32.c (kill): negate pid under Win9x.
+
Wed Aug 28 16:36:40 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* configure.in (ar): don't check twice for ar.
@@ -16,6 +20,7 @@ Wed Aug 28 15:00:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_intern): ditto.
+>>>>>>> 1.1095
Wed Aug 28 11:37:35 2002 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.h: define SIGINT and SIGKILL if not defined.
diff --git a/win32/win32.c b/win32/win32.c
index e9edfdfc14..dec014c388 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2337,23 +2337,30 @@ kill(int pid, int sig)
{
int ret = 0;
+ if (pid <= 0) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (IsWin95()) pid = -pid;
if ((unsigned int)pid == GetCurrentProcessId() && sig != SIGKILL)
return raise(sig);
- if (sig == SIGINT && pid > 0) {
+ switch (sig) {
+ case SIGINT:
RUBY_CRITICAL({
if (!GenerateConsoleCtrlEvent(CTRL_C_EVENT, (DWORD)pid)) {
- errno = GetLastError();
+ if ((errno = GetLastError()) == 0) {
+ errno = EPERM;
+ }
ret = -1;
}
});
- }
- else if (sig == SIGKILL && pid > 0) {
- HANDLE hProc;
+ break;
+ case SIGKILL:
RUBY_CRITICAL({
- hProc = OpenProcess(PROCESS_TERMINATE, FALSE,
- IsWin95() ? -pid : pid);
+ HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, (DWORD)pid);
if (hProc == NULL || hProc == INVALID_HANDLE_VALUE) {
if (GetLastError() == ERROR_INVALID_PARAMETER) {
errno = ESRCH;
@@ -2369,10 +2376,12 @@ kill(int pid, int sig)
}
CloseHandle(hProc);
});
- }
- else {
+ break;
+
+ define:
errno = EINVAL;
ret = -1;
+ break;
}
return ret;