From dd3939e950f0d0196308dc967b438417355798cd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Mar 2016 05:52:14 +0000 Subject: daemon: avoid cyclic references for once-used callbacks Not that these subs are repeatedly created, but this makes the code easier-to-review and these callbacks are idempotent anyways. --- lib/PublicInbox/Daemon.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/PublicInbox/Daemon.pm') 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); }; } -- cgit v1.2.3-24-ge0c7