[Mageia-sysadm] [306] allow to use umask option for cp

root at mageia.org root at mageia.org
Sun Jan 16 23:31:43 CET 2011


Revision: 306
Author:   blino
Date:     2011-01-16 23:31:43 +0100 (Sun, 16 Jan 2011)
Log Message:
-----------
allow to use umask option for cp

Modified Paths:
--------------
    build_system/iurt/trunk/iurt_root_command

Modified: build_system/iurt/trunk/iurt_root_command
===================================================================
--- build_system/iurt/trunk/iurt_root_command	2011-01-15 23:43:22 UTC (rev 305)
+++ build_system/iurt/trunk/iurt_root_command	2011-01-16 22:31:43 UTC (rev 306)
@@ -294,6 +294,10 @@
 	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 @@
 	    }
 	}
     }
+
+    umask($prev_umask) if $opt->{umask};
+
     if (!$done) { plog('DEBUG', "nothing copied") }
     $ok;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110116/92b5200b/attachment.html>


More information about the Mageia-sysadm mailing list