]> git.g-eek.se Git - interimap.git/commitdiff
Net::IMAP::InterIMAP: set binmode on the socket (and our pipe ends)
authorGuilhem Moulin <guilhem@fripost.org>
Fri, 11 Mar 2016 23:52:04 +0000 (00:52 +0100)
committerGuilhem Moulin <guilhem@fripost.org>
Fri, 11 Mar 2016 23:52:12 +0000 (00:52 +0100)
lib/Net/IMAP/InterIMAP.pm
pullimap

index 1686448bb571e17abf5534571f8bf5519706cfa2..f3e9c9eb2c7f5b2106f06263d050d6c93b8853d6 100644 (file)
@@ -313,6 +313,9 @@ sub new($%) {
         foreach ($rd, $wd) {
             close $_ or $self->panic("Can't close: $!");
         }
+        foreach (qw/STDIN STDOUT/) {
+            binmode($self->{$_}) // $self->panic("binmode: $!")
+        }
     }
     else {
         foreach (qw/host port/) {
@@ -338,10 +341,10 @@ sub new($%) {
         setsockopt($socket, Socket::IPPROTO_TCP, 18, 1000 * $cnt * $intvl)
             or $self->fail("Can't setsockopt TCP_USER_TIMEOUT: $!");
 
+        binmode($socket) // $self->panic("binmode: $!");
         $self->_start_ssl($socket) if $self->{type} eq 'imaps';
         $self->{$_} = $socket for qw/STDOUT STDIN/;
     }
-    binmode $self->{$_} foreach qw/STDIN STDOUT/;
 
     # command counter
     $self->{_TAG} = 0;
index c8d40187ecd9623b3bf77bc38988782d4c414213..8eb2ac023e56659a0762b1f0cb9619b189430942 100755 (executable)
--- a/pullimap
+++ b/pullimap
@@ -142,6 +142,7 @@ sub sendmail($$) {
             next if $! == EINTR; # try again if connect(2) was interrupted by a signal
             die "connect: $!";
         }
+        binmode($SMTP) // die "binmode: $!";
 
         smtp_resp('220');
         my @r = smtp_send($ehlo => '250');