From 9af18742854b01ae9e21ac1a54dacb3e0b38d1b7 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Sat, 23 Dec 2006 23:27:50 +0000 Subject: [PATCH] (scm_kill): When only raise() is available, throw an ENOSYS error if pid is not our own process, instead of silently doing nothing. --- libguile/posix.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libguile/posix.c b/libguile/posix.c index 82f27b1c7..58d63bc5b 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -487,11 +487,25 @@ SCM_DEFINE (scm_kill, "kill", 2, 0, 0, /* Signal values are interned in scm_init_posix(). */ #ifdef HAVE_KILL if (kill (scm_to_int (pid), scm_to_int (sig)) != 0) + SCM_SYSERROR; #else + /* Mingw has raise(), but not kill(). (Other raw DOS environments might + be similar.) Use raise() when the requested pid is our own process, + otherwise bomb. */ if (scm_to_int (pid) == getpid ()) - if (raise (scm_to_int (sig)) != 0) + { + if (raise (scm_to_int (sig)) != 0) + { + err: + SCM_SYSERROR; + } + else + { + errno = ENOSYS; + goto err; + } + } #endif - SCM_SYSERROR; return SCM_UNSPECIFIED; } #undef FUNC_NAME