aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-ximapsync21
-rw-r--r--lib/Net/IMAP/Sync.pm1
2 files changed, 8 insertions, 14 deletions
diff --git a/imapsync b/imapsync
index 25e65d6..b9d2d31 100755
--- a/imapsync
+++ b/imapsync
@@ -93,13 +93,13 @@ my $DBH;
# Clean after us
sub cleanup() {
- logger("Cleaning up...") if $CONFIG{debug};
+ logger(undef, "Cleaning up...") if $CONFIG{debug};
unlink $LOCKFILE if defined $LOCKFILE and -f $LOCKFILE;
close $LOGGER_FD if defined $LOGGER_FD;
$DBH->disconnect() if defined $DBH;
}
-$SIG{$_} = sub { cleanup(); msg(undef, $!); exit 1; } foreach qw/INT TERM/;
-$SIG{$_} = sub { cleanup(); msg(undef, $!); exit 0; } foreach qw/HUP/;
+$SIG{$_} = sub { msg(undef, $!); cleanup(); exit 1; } foreach qw/INT TERM/;
+$SIG{$_} = sub { msg(undef, $!); cleanup(); exit 0; } foreach qw/HUP/;
#############################################################################
@@ -627,7 +627,7 @@ sub download_missing($$$@) {
# Solve a flag update conflict (by taking the union of the two flag lists).
sub flag_conflict($$$$$) {
- my ($mailbox, $lUID, $lFlags, $rUID, $rFlags);
+ my ($mailbox, $lUID, $lFlags, $rUID, $rFlags) = @_;
my %flags = map {$_ => 1} (split(/ /, $lFlags), split(/ /, $rFlags));
my $flags = join ' ', sort(keys %flags);
@@ -947,7 +947,8 @@ sub callback_new_message_flush($$$@) {
my ($lUIDs, $rUIDs) = $name eq 'local' ? (\@sUID,\@tUID) : (\@tUID,\@sUID);
for (my $k=0; $k<=$#messages; $k++) {
- logger("Adding mapping (lUID,rUID) = ($lUIDs->[$k],$rUIDs->[$k]) for $mailbox") if $CONFIG{debug};
+ logger(undef, "Adding mapping (lUID,rUID) = ($lUIDs->[$k],$rUIDs->[$k]) for $mailbox")
+ if $CONFIG{debug};
$STH_INSERT_MAPPING->execute($idx, $lUIDs->[$k], $rUIDs->[$k]);
}
$DBH->commit(); # commit only once per batch
@@ -1102,10 +1103,7 @@ while (@REPAIR) {
$rIMAP->select($MAILBOX);
repair($IDX, $MAILBOX);
}
-if ($CONFIG{repair}) {
- cleanup();
- exit 0;
-}
+exit 0 if $CONFIG{repair};
while(1) {
@@ -1153,10 +1151,7 @@ while(1) {
}
}
# clean state!
- if ($CONFIG{oneshot}) {
- cleanup();
- exit 0;
- }
+ exit 0 if $CONFIG{oneshot};
wait_notifications(900);
}
diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm
index bf56519..3216483 100644
--- a/lib/Net/IMAP/Sync.pm
+++ b/lib/Net/IMAP/Sync.pm
@@ -736,7 +736,6 @@ sub slurp($) {
# select(2) to block/timeout due to the raw socket not being
# ready.
unless (ref $stdout eq 'IO::Socket::SSL' and $stdout->pending() > 0) {
- my $sel = IO::Select::->new($stdout);
my ($ok) = $self->{_SEL_OUT}->can_read(0);
return $read unless defined $ok;
}