about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2001-09-21 01:10:45 +0000
committerGraham Barr <gbarr@pobox.com>2001-09-21 01:10:45 +0000
commit091310e86dd1f0a0f9dd6f6ec2d5c17fac5ef254 (patch)
tree638da72f584494cca64d48037fbf32734fa2b80e
parent7406b8a57fd0d062ffdecbb4ece91d74510846b5 (diff)
downloadperl-libnet-091310e86dd1f0a0f9dd6f6ec2d5c17fac5ef254.tar.gz
Net::FTP
- use sysopen instead of open so we don't get caught by special chars in the filename

-rw-r--r--Net/FTP.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/Net/FTP.pm b/Net/FTP.pm
index a1daedc..80fe593 100644
--- a/Net/FTP.pm
+++ b/Net/FTP.pm
@@ -19,9 +19,10 @@ use IO::Socket;
 use Time::Local;
 use Net::Cmd;
 use Net::Config;
+use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC);
 # use AutoLoader qw(AUTOLOAD);
 
-$VERSION = "2.58"; # $Id: //depot/libnet/Net/FTP.pm#57 $
+$VERSION = "2.58"; # $Id: //depot/libnet/Net/FTP.pm#58 $
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -448,7 +449,7 @@ sub get
   {
    $loc = \*FD;
 
-   unless(($where) ? open($loc,">>$local") : open($loc,">$local"))
+   unless(sysopen($loc, $local, O_CREAT | O_WRONLY | ($where ? O_APPEND : O_TRUNC)))
     {
      carp "Cannot open Local file $local: $!\n";
      $data->abort;
@@ -706,7 +707,7 @@ sub _store_cmd
   {
    $loc = \*FD;
 
-   unless(open($loc,"<$local"))
+   unless(sysopen($loc, $local, O_RDONLY))
     {
      carp "Cannot open Local file $local: $!\n";
      return undef;
@@ -1717,6 +1718,6 @@ under the same terms as Perl itself.
 
 =for html <hr>
 
-I<$Id: //depot/libnet/Net/FTP.pm#57 $>
+I<$Id: //depot/libnet/Net/FTP.pm#58 $>
 
 =cut