diff options
author | Graham Barr <gbarr@pobox.com> | 2000-05-16 07:48:59 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 2000-05-16 07:48:59 +0000 |
commit | 8f4862b0b3c80c4ba7fa6b15309f2fe5946ccfe6 (patch) | |
tree | fbebe5010022945bd7039a033b4da4266ea57efe | |
parent | bec671a87f3080a22c11b387486b0266841b0cb1 (diff) | |
download | perl-libnet-8f4862b0b3c80c4ba7fa6b15309f2fe5946ccfe6.tar.gz |
Net::FTP::A, Net::FTP::I
- Restrict the number of bytes given to syswrite to be at most net_ftp_blksize. This fixes a bug on VMS where the OS will return an error if syswrite is given more than 65535 bytes.
-rw-r--r-- | Net/FTP/A.pm | 8 | ||||
-rw-r--r-- | Net/FTP/I.pm | 7 | ||||
-rwxr-xr-x | demos/snpp | 5 |
3 files changed, 11 insertions, 9 deletions
diff --git a/Net/FTP/A.pm b/Net/FTP/A.pm index 90730f9..764e915 100644 --- a/Net/FTP/A.pm +++ b/Net/FTP/A.pm @@ -1,4 +1,4 @@ -## $Id: //depot/libnet/Net/FTP/A.pm#15 $ +## $Id: //depot/libnet/Net/FTP/A.pm#16 $ ## Package to read/write on ASCII data connections ## @@ -10,7 +10,7 @@ use Carp; require Net::FTP::dataconn; @ISA = qw(Net::FTP::dataconn); -$VERSION = "1.14"; +$VERSION = "1.15"; sub read { my $data = shift; @@ -82,12 +82,14 @@ sub write { my $off = 0; my $wrote = 0; + my $blksize = ${*$data}{'net_ftp_blksize'}; + while($len) { $data->can_write($timeout) or croak "Timeout"; $off += $wrote; - $wrote = syswrite($data, substr($tmp,$off), $len); + $wrote = syswrite($data, substr($tmp,$off), $len > $blksize ? $blksize : $len); return undef unless defined($wrote); $len -= $wrote; diff --git a/Net/FTP/I.pm b/Net/FTP/I.pm index d19dc32..486dc96 100644 --- a/Net/FTP/I.pm +++ b/Net/FTP/I.pm @@ -1,4 +1,4 @@ -## $Id: //depot/libnet/Net/FTP/I.pm#10 $ +## $Id: //depot/libnet/Net/FTP/I.pm#11 $ ## Package to read/write on BINARY data connections ## @@ -10,7 +10,7 @@ use Carp; require Net::FTP::dataconn; @ISA = qw(Net::FTP::dataconn); -$VERSION = "1.09"; +$VERSION = "1.10"; sub read { my $data = shift; @@ -54,11 +54,12 @@ sub write { my $sent = $size; my $off = 0; + my $blksize = ${*$data}{'net_ftp_blksize'}; while($sent > 0) { $data->can_write($timeout) or croak "Timeout"; - my $n = syswrite($data, $buf, $sent,$off); + my $n = syswrite($data, $buf, $sent > $blksize ? $blksize : $sent ,$off); return undef unless defined($n); $sent -= $n; $off += $n; @@ -8,7 +8,7 @@ $opt_debug = undef; $opt_h = undef; $opt_p = undef; -GetOptions(qw(debug h p)); +GetOptions(qw(debug h:s p:s)); die "usage: $0 -h <host> -p <pagerid> <message>" unless defined $opt_h && defined $opt_p && @ARGV; @@ -16,8 +16,7 @@ die "usage: $0 -h <host> -p <pagerid> <message>" Net::SNPP->debug(1) if $opt_debug; -$snpp = Net::SNPP->new($opt_host); - +$snpp = Net::SNPP->new($opt_h) or die "$! $@"; $snpp->pager_id($opt_p) || die $snpp->message; $snpp->content(join(" ",@ARGV)) || die $snpp->message; $snpp->send() || die $snpp->message; |