about summary refs log tree commit homepage
path: root/lib/PublicInbox/Daemon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-03-05 05:52:14 +0000
committerEric Wong <e@80x24.org>2016-03-05 05:53:16 +0000
commitdd3939e950f0d0196308dc967b438417355798cd (patch)
tree164da6454d7a055ca5877ba3f139b32cc49bb1d1 /lib/PublicInbox/Daemon.pm
parentefdca7b8e80e74501d14eb0bee74f78309db287b (diff)
downloadpublic-inbox-dd3939e950f0d0196308dc967b438417355798cd.tar.gz
Not that these subs are repeatedly created, but this makes
the code easier-to-review and these callbacks are idempotent
anyways.
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r--lib/PublicInbox/Daemon.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index c3199cd2..30411e13 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -109,6 +109,7 @@ sub daemonize () {
         # The upgrade will create the ".oldbin" pid file in the
         # same directory as the given pid file.
         $uid and $set_user = sub {
+                $set_user = undef;
                 Net::Server::Daemonize::set_user($uid, $gid);
         };
 
@@ -128,6 +129,7 @@ sub daemonize () {
                 write_pid($pid_file);
                 my $unlink_pid = $$;
                 $cleanup = sub {
+                        $cleanup = undef; # avoid cyclic reference
                         unlink_pid_file_safe_ish($unlink_pid, $pid_file);
                 };
         }