diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2016-03-05 19:49:08 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2016-03-05 19:49:08 +0100 |
commit | 76be3c7c47ace843ab3ebd216252c63411a1222e (patch) | |
tree | 5fbea96acdc8dba73d5ef4ba218fc45fe630b61d /interimap | |
parent | 0c21fadd7683629c50d1068106b17e9ac1addc62 (diff) |
Ensure the FD_CLOEXEC bit is 1 on sockets, logger and state files.
Diffstat (limited to 'interimap')
-rwxr-xr-x | interimap | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -26,6 +26,7 @@ my $NAME = 'interimap'; use Getopt::Long qw/:config posix_default no_ignore_case gnu_compat bundling auto_version/; use DBI (); +use Fcntl qw/F_GETFL F_SETFL FD_CLOEXEC/; use List::Util 'first'; use lib 'lib'; @@ -101,6 +102,8 @@ my ($DBFILE, $LOCKFILE, $LOGGER_FD); open $LOGGER_FD, '>>', $CONF->{_}->{logfile} or die "Can't open $CONF->{_}->{logfile}: $!\n"; $LOGGER_FD->autoflush(1); + my $flags = fcntl($LOGGER_FD, F_GETFL, 0) or die "fcntl F_GETFL: $!"; + fcntl($LOGGER_FD, F_SETFL, $flags | FD_CLOEXEC) or die "fcntl F_SETFL: $!"; } elsif ($CONFIG{debug}) { $LOGGER_FD = \*STDERR; |