diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2015-09-08 00:17:24 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2015-09-08 00:19:47 +0200 |
commit | 6a40ecf6aec13bf650645d65713c0327c6d8c5e6 (patch) | |
tree | 5ec8f1b59a6b525f5afd98cfce9796b35638ca53 /interimap | |
parent | ac3e4cf6300448e9c83b45db1b769d79c6df2e38 (diff) |
Block SIGINT signals to the children for type=tunnel.
So we can clean after us (and for instance remove the lockfile).
Diffstat (limited to 'interimap')
-rwxr-xr-x | interimap | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -51,10 +51,12 @@ sub usage(;$) { } exit $rv; } -usage(1) unless GetOptions(\%CONFIG, qw/config=s quiet|q target=s@ debug help|h repair delete rename/); + +my @COMMANDS = qw/repair delete rename/; +usage(1) unless GetOptions(\%CONFIG, qw/config=s quiet|q target=s@ debug help|h/, @COMMANDS); usage(0) if $CONFIG{help}; my $COMMAND = do { - my @command = grep {exists $CONFIG{$_}} qw/repair delete rename/; + my @command = grep {exists $CONFIG{$_}} @COMMANDS; usage(1) if $#command>0; $command[0] }; @@ -200,7 +202,8 @@ $DBH->do('PRAGMA foreign_keys = ON'); sub msg($@) { my $name = shift; return unless @_; - logger($name, @_) if defined $LOGGER_FD and $LOGGER_FD->fileno != fileno STDERR; + logger($name, @_) if defined $LOGGER_FD and defined $LOGGER_FD->fileno + and $LOGGER_FD->fileno != fileno STDERR; my $prefix = defined $name ? "$name: " : ''; print STDERR $prefix, @_, "\n"; } @@ -208,7 +211,8 @@ sub logger($@) { my $name = shift; return unless @_ and defined $LOGGER_FD; my $prefix = ''; - if ($LOGGER_FD->fileno != fileno STDERR) { + if (defined $LOGGER_FD and defined $LOGGER_FD->fileno + and $LOGGER_FD->fileno != fileno STDERR) { my ($s, $us) = Time::HiRes::gettimeofday(); $prefix = POSIX::strftime("%b %e %H:%M:%S", localtime($s)).".$us "; } |