On Sat, 2006-02-18 at 08:06 +0100, Javier Fernández-Sanguino Peña wrote:

> Should the check
> 
>      [ ! -f "$PIDFILE" ] && return 1
> 
> cover that? I don't see why that should fail, if the PIDFILE does not exist
> it should not go ahead and try to read from it.

It will cover it for most cases, but there is a race in the pathological
case where you call stop twice in quick succession and the second call
gets through to the running function before the TERM signal from first
reaches the daemon and causes the pidfile to be removed. 

Doesn't happen very often, perhaps never in real life, but my tests were
running two stops in a row (/etc/init.d/portreserve
stop; /etc/init.d/portreserve stop) which did trigger it. It doesn't
hurt the code to handle it nicely, so why not make the script more
robust? 

Cheers

-- 
Matt Brown
[EMAIL PROTECTED]
Mob +64 21 611 544 www.mattb.net.nz

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to