1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-09 15:10:29 +02:00

(scm_kill): When only raise() is available, throw an ENOSYS

error if pid is not our own process, instead of silently doing nothing.
This commit is contained in:
Kevin Ryde 2006-12-23 23:27:50 +00:00
parent ac506e6a50
commit 9af1874285

View file

@ -487,11 +487,25 @@ SCM_DEFINE (scm_kill, "kill", 2, 0, 0,
/* Signal values are interned in scm_init_posix(). */ /* Signal values are interned in scm_init_posix(). */
#ifdef HAVE_KILL #ifdef HAVE_KILL
if (kill (scm_to_int (pid), scm_to_int (sig)) != 0) if (kill (scm_to_int (pid), scm_to_int (sig)) != 0)
SCM_SYSERROR;
#else #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 (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 #endif
SCM_SYSERROR;
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
} }
#undef FUNC_NAME #undef FUNC_NAME