summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-01-03 12:47:46 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-01-03 12:47:46 +0000
commitf71b7b6c7741fa5ff6e4c26790f2a353febe4285 (patch)
treefb52df012a450ade092ddb8fd1cfd34c11f8ddb3
parentdc0d4fc6ccc74019504ea9cc7ae8ae21850f7bb5 (diff)
downloadperl-MDK-Common-f71b7b6c7741fa5ff6e4c26790f2a353febe4285.tar
perl-MDK-Common-f71b7b6c7741fa5ff6e4c26790f2a353febe4285.tar.gz
perl-MDK-Common-f71b7b6c7741fa5ff6e4c26790f2a353febe4285.tar.bz2
perl-MDK-Common-f71b7b6c7741fa5ff6e4c26790f2a353febe4285.tar.xz
perl-MDK-Common-f71b7b6c7741fa5ff6e4c26790f2a353febe4285.zip
use POSIX instead of Fcntl (perl-base compliance)
-rw-r--r--MDK/Common/File.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/MDK/Common/File.pm b/MDK/Common/File.pm
index 5df7b4f..c4e1ad4 100644
--- a/MDK/Common/File.pm
+++ b/MDK/Common/File.pm
@@ -141,9 +141,15 @@ sub output_with_perm { my ($f, $perm, @l) = @_; mkdir_p(dirname($f)); output($f,
sub linkf { unlink $_[1]; link $_[0], $_[1] }
sub symlinkf { unlink $_[1]; symlink $_[0], $_[1] }
sub renamef { unlink $_[1]; rename $_[0], $_[1] }
-use Fcntl;
-sub secured_output { my $f = shift; unlink($f); sysopen(my $F, $f, O_CREAT|O_EXCL|O_RDWR) or die "secure output in file $f failed: $! $@\n"; print $F $_ foreach @_; 1 }
+sub secured_output {
+ my ($f, @l) = @_;
+ require POSIX;
+ unlink($f);
+ sysopen(my $F, $f, POSIX::O_CREAT() | POSIX::O_EXCL() | POSIX::O_RDWR()) or die "secure output in file $f failed: $! $@\n";
+ print $F $_ foreach @l;
+ 1;
+}
sub mkdir_p {
my ($dir) = @_;