Subject: | incorrect handling of $handle from SSH2_FXP_OPEN |
Error found in Net/SFTP.pm revision 1.30 in subroutine put / line 449
We are connecting to a lame windows sftp server with returns "0" as a handle in response to SSH2_FXP_OPEN. Unfortunately, while this is a valid arbitrary string, its also false causing 0 length files to be created on the server.
original:
my $handle = $sftp->do_open($remote, SSH2_FXF_WRITE | SSH2_FXF_CREAT |
SSH2_FXF_TRUNC, $a) or return; # check status for info
fixed:
my $handle = $sftp->do_open($remote, SSH2_FXF_WRITE | SSH2_FXF_CREAT |
SSH2_FXF_TRUNC, $a);
return unless defined $handle; # check status for info
Thanks for an otherwise great module!
Jim Herring