mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-08 22:50:27 +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:
parent
ac506e6a50
commit
9af1874285
1 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue