summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNate <niicodemus@gmail.com>2011-10-04 01:29:54 -0700
committerdormando <dormando@rydia.net>2011-10-04 01:29:54 -0700
commit32cb494970d00324ebe50f48b90e76faed749986 (patch)
treec134a753fdf932eb6d304f38f7edcb5e4f372554 /scripts
parentc9055e8423b2ccbe7bf18fc1224a069574886fd0 (diff)
downloadmemcached-32cb494970d00324ebe50f48b90e76faed749986.tar.gz
start-memcached writing wrong PID to $pidfile1.4.8
after the doublefork was added, the pidfile was now of the intermediary pid, not the one forked after setsid.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/start-memcached17
1 files changed, 8 insertions, 9 deletions
diff --git a/scripts/start-memcached b/scripts/start-memcached
index aa9dabe..ce39fa6 100755
--- a/scripts/start-memcached
+++ b/scripts/start-memcached
@@ -112,18 +112,17 @@ if($pid == 0)
# must fork again now that tty is closed
$pid = fork();
if ($pid) {
+ if(open PIDHANDLE,">$pidfile")
+ {
+ print PIDHANDLE $pid;
+ close PIDHANDLE;
+ }else{
+
+ print STDERR "Can't write pidfile to $pidfile.\n";
+ }
exit(0);
}
exec "$memcached $params";
exit(0);
-}else{
- if(open PIDHANDLE,">$pidfile")
- {
- print PIDHANDLE $pid;
- close PIDHANDLE;
- }else{
-
- print STDERR "Can't write pidfile to $pidfile.\n";
- }
}