lib/PublicInbox/DS.pm | 3 +-- lib/PublicInbox/Daemon.pm | 7 ++----- diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index a6c43b22d960ae9c01765e126677f3521c44e115..e4629e97acc461aaa2debbe1687db8f0aecab796 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -130,8 +130,7 @@ if (defined $PublicInbox::Syscall::SYS_epoll_create) { my $fd = epoll_create(); die "epoll_create: $!" if $fd < 0; open($ep_io, '+<&=', $fd) or return; - my $fl = fcntl($ep_io, F_GETFD, 0); - fcntl($ep_io, F_SETFD, $fl | FD_CLOEXEC); + fcntl($ep_io, F_SETFD, FD_CLOEXEC); $fd; } else { my $cls; diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 16bae23106e746cd4dd53c7cfb99dcc83693eb79..ee746f057d66b5a1df5daa196671026323d72bab 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -11,7 +11,7 @@ use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); use IO::Handle; # ->autoflush use IO::Socket; use File::Spec; -use POSIX qw(WNOHANG :signal_h); +use POSIX qw(WNOHANG :signal_h F_SETFD); use Socket qw(IPPROTO_TCP SOL_SOCKET); STDOUT->autoflush(1); STDERR->autoflush(1); @@ -478,15 +478,12 @@ warn "fork failed: $!\n"; return; } if ($pid == 0) { - use Fcntl qw(FD_CLOEXEC F_SETFD F_GETFD); $ENV{LISTEN_FDS} = scalar @listeners; $ENV{LISTEN_PID} = $$; foreach my $s (@listeners) { # @listeners are globs with workers, PI::L w/o workers $s = $s->{sock} if ref($s) eq 'PublicInbox::Listener'; - - my $fl = fcntl($s, F_GETFD, 0); - fcntl($s, F_SETFD, $fl &= ~FD_CLOEXEC); + fcntl($s, F_SETFD, 0) // die "F_SETFD: $!"; } exec @CMD; die "Failed to exec: $!\n";