From 18d4ef57d1c13a794056f0125fbd62f99c0ff2da Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Sun, 16 Jan 2011 22:31:43 +0000 Subject: allow to use umask option for cp --- iurt_root_command | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/iurt_root_command b/iurt_root_command index 1880e44..6fb68af 100755 --- a/iurt_root_command +++ b/iurt_root_command @@ -294,6 +294,10 @@ sub cp { plog('FAIL', "copying to $dest forbidden"); return; } + + my $prev_umask = umask(); + umask($prev_umask | $opt->{umask}) if $opt->{umask}; + foreach my $f (@files) { if (-d $f) { if (!$opt->{recursive}) { @@ -326,6 +330,9 @@ sub cp { } } } + + umask($prev_umask) if $opt->{umask}; + if (!$done) { plog('DEBUG', "nothing copied") } $ok; } -- cgit v1.2.1