diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2016-03-07 18:21:46 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2016-03-07 18:21:46 +0100 |
commit | 58d6bd5be5ce08c55448a82ea20039808c1e214e (patch) | |
tree | 3c45eaf0aafd07fcad082595a6296b477d8573e5 /interimap | |
parent | 5f97601949f10e085a0df740c628cbfbfdf1d49f (diff) | |
parent | feb047ee7fcc1f93bc1e76626e16651761e0db55 (diff) |
Merge branch 'master' into debian
Diffstat (limited to 'interimap')
-rwxr-xr-x | interimap | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,8 +1,8 @@ #!/usr/bin/perl -T #---------------------------------------------------------------------- -# Fast two-way synchronization program for QRESYNC-capable IMAP servers -# Copyright © 2015 Guilhem Moulin <guilhem@fripost.org> +# Fast bidirectional synchronization for QRESYNC-capable IMAP servers +# Copyright © 2015,2016 Guilhem Moulin <guilhem@fripost.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,15 +21,16 @@ use strict; use warnings; -our $VERSION = '0.2'; +our $VERSION = '0.3'; 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'; -use Net::IMAP::InterIMAP qw/read_config compact_set $IMAP_text $IMAP_cond/; +use Net::IMAP::InterIMAP qw/read_config compact_set/; # Clean up PATH $ENV{PATH} = join ':', qw{/usr/local/bin /usr/bin /bin}; @@ -65,6 +66,7 @@ usage(1) if defined $COMMAND and defined $CONFIG{watch}; usage(1) if $CONFIG{target} and !(defined $COMMAND and ($COMMAND eq 'delete'or $COMMAND eq 'rename')); $CONFIG{watch} = 60 if defined $CONFIG{watch} and $CONFIG{watch} == 0; @ARGV = map {uc $_ eq 'INBOX' ? 'INBOX' : $_ } @ARGV; # INBOX is case-insensitive +die "Invalid mailbox name $_" foreach grep !/\A([\x01-\x7F]+)\z/, @ARGV; my $CONF = read_config( delete $CONFIG{config} // $NAME @@ -101,6 +103,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; |