diff options
author | Graham Barr <gbarr@pobox.com> | 1997-09-13 02:38:35 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 2009-01-24 16:58:36 -0600 |
commit | a6c70bc9946494915d7817dcd61a661ed3009117 (patch) | |
tree | d61674149821e1bc4579d2be97ae2e4267bf14d1 | |
parent | aaf4b10e5d8dde88caf65b0c71819ba0ffbb620c (diff) | |
download | perl-libnet-a6c70bc9946494915d7817dcd61a661ed3009117.tar.gz |
Net::FTP
- Modified to use AutoLoader - Fixed Net::FTP::[AI]::write to trap SIGPIPE errors and return an error, instead of aborting the script
-rw-r--r-- | Net/FTP.pm | 2 | ||||
-rw-r--r-- | Net/FTP/A.pm | 7 | ||||
-rw-r--r-- | Net/FTP/I.pm | 5 |
3 files changed, 13 insertions, 1 deletions
@@ -607,6 +607,8 @@ sub _dataconn my $data = undef; my $pkg = "Net::FTP::" . $ftp->type; + eval "require " . $pkg; + $pkg =~ s/ /_/g; delete ${*$ftp}{'net_ftp_dataconn'}; diff --git a/Net/FTP/A.pm b/Net/FTP/A.pm index c06e45c..97b76e4 100644 --- a/Net/FTP/A.pm +++ b/Net/FTP/A.pm @@ -78,10 +78,15 @@ sub write my $tmp; ($tmp = $buf) =~ s/(?!\015)\012/\015\012/sg; + # If the remote server has closed the connection we will be signal'd + # when we write. This can happen if the disk on the remote server fills up + + local $SIG{PIPE} = 'IGNORE'; + my $len = $size + length($tmp) - length($buf); my $wrote = syswrite($data, $tmp, $len); - if($wrote >= 0) + if($wrote > 0) { $wrote = $wrote == $len ? $size : $len - $wrote diff --git a/Net/FTP/I.pm b/Net/FTP/I.pm index 6f6f814..d106e9c 100644 --- a/Net/FTP/I.pm +++ b/Net/FTP/I.pm @@ -36,6 +36,11 @@ sub write $data->can_write($timeout) or croak "Timeout"; + # If the remote server has closed the connection we will be signal'd + # when we write. This can happen if the disk on the remote server fills up + + local $SIG{PIPE} = 'IGNORE'; + syswrite($data, $buf, $size); } |