mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 00:30:49 +00:00
don't try to copy file/group ownership
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36747 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d29e2005e9
commit
a0875b7adb
2 changed files with 20 additions and 13 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-06-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSFileManager.m: Don't attempt to set ownership of copied
|
||||
file. The code was already doing this right for directories, but
|
||||
not for other file types.
|
||||
|
||||
2013-06-21 Lubos Dolezel <lubos@dolezel.info>
|
||||
|
||||
* Headers/GSBlocks.h: weakly import _Block_copy and _Block_release
|
||||
|
|
|
@ -1039,32 +1039,33 @@ static NSStringEncoding defaultEncoding;
|
|||
return NO;
|
||||
}
|
||||
fileType = [attrs fileType];
|
||||
|
||||
/*
|
||||
* Don't attempt to retain ownership of copy ... we want the copy
|
||||
* to be owned by the current user.
|
||||
*/
|
||||
attrs = AUTORELEASE([attrs mutableCopy]);
|
||||
[(NSMutableDictionary*)attrs removeObjectForKey: NSFileOwnerAccountID];
|
||||
[(NSMutableDictionary*)attrs removeObjectForKey: NSFileGroupOwnerAccountID];
|
||||
(NSMutableDictionary*)mattrs removeObjectForKey: NSFileGroupOwnerAccountName];
|
||||
(NSMutableDictionary*)mattrs setObject: NSUserName()
|
||||
forKey: NSFileOwnerAccountName];
|
||||
|
||||
if ([fileType isEqualToString: NSFileTypeDirectory] == YES)
|
||||
{
|
||||
NSMutableDictionary *mattrs;
|
||||
|
||||
/* If destination directory is a descendant of source directory copying
|
||||
isn't possible. */
|
||||
if ([[destination stringByAppendingString: @"/"]
|
||||
hasPrefix: [source stringByAppendingString: @"/"]])
|
||||
{
|
||||
ASSIGN(_lastError, @"Could not copy - destination is a descendant of source");
|
||||
ASSIGN(_lastError,
|
||||
@"Could not copy - destination is a descendant of source");
|
||||
return NO;
|
||||
}
|
||||
|
||||
[self _sendToHandler: handler willProcessPath: destination];
|
||||
|
||||
/*
|
||||
* Don't attempt to retain ownership of copy ... we want the copy
|
||||
* to be owned by the current user.
|
||||
*/
|
||||
mattrs = [attrs mutableCopy];
|
||||
[mattrs removeObjectForKey: NSFileOwnerAccountID];
|
||||
[mattrs removeObjectForKey: NSFileGroupOwnerAccountID];
|
||||
[mattrs removeObjectForKey: NSFileGroupOwnerAccountName];
|
||||
[mattrs setObject: NSUserName() forKey: NSFileOwnerAccountName];
|
||||
attrs = AUTORELEASE(mattrs);
|
||||
|
||||
if ([self createDirectoryAtPath: destination attributes: attrs] == NO)
|
||||
{
|
||||
return [self _proceedAccordingToHandler: handler
|
||||
|
|
Loading…
Reference in a new issue