Explicit file locking support for pidfiles (see normal flock provisos)
This commit is contained in:
parent
91e3e2980d
commit
5d7b98dadb
@ -566,6 +566,7 @@ sub write_pid {
|
||||
|
||||
open(PIDFILE, "> $filename")
|
||||
or croak "FATAL: Unable to open PID file for writing: $!";
|
||||
flock(PIDFILE, 2);
|
||||
|
||||
print PIDFILE $$;
|
||||
|
||||
@ -584,6 +585,7 @@ sub read_pid {
|
||||
|
||||
open(PIDFILE, "< $filename")
|
||||
or croak "FATAL: Unable to open PID file for reading: $!";
|
||||
flock(PIDFILE, 1);
|
||||
|
||||
my $pid = <PIDFILE>;
|
||||
close(PIDFILE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user