Re: g_spawn_async_with_pipes() and kill()



On Tuesday 12 September 2006 23:19, Rui Tiago Cação Matos wrote:
On Ter, 2006-09-12 at 22:37 +0100, Chris Vine wrote:
Yes, in Linux (and probably most other Unix-like OSs), SIGTERM is defined
as 15.

Maybe I haven't explained myself clearly. I know SIGTERM is defined as
15. Ok, but shouldn't kill(PID, SIGTERM) do the right thing and kill
_only_ the application with pid PID? Because right now it kill my pppd
and also my application (the one which calls kill()).

Sorry, I misunderstood. Yes, kill() will only issue a signal to the specified 
PID if PID is a value greater than 0.  In particular sending SIGTERM to the 
child PID will not also send it to the parent, so it looks as if the value 
you pass it must have been corrupted in some way before you got to the call 
to kill().

It would therefore be worth checking the value of self->pppd_pid before you 
call kill() on it - for example if it is 0 then it will send the SIGTERM 
signal to all processes in the same process group as the caller, including 
the calling process.

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]