mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
When overwriting a file with data, do not attempt to set creation date.
When creaqting a new file, try to use the real uid when effective uid is root
This commit is contained in:
parent
b7882e3194
commit
31ea5db30b
1 changed files with 15 additions and 5 deletions
|
@ -1800,8 +1800,17 @@ failure:
|
|||
[att removeObjectForKey: NSFileType];
|
||||
if ([mgr changeFileAttributes: att atPath: path] == NO)
|
||||
{
|
||||
NSWarnMLog(@"Unable to correctly set all attributes for '%@'",
|
||||
path);
|
||||
NSWarnMLog(@"Unable to correctly set attributes for '%@' to %@",
|
||||
path, att);
|
||||
}
|
||||
}
|
||||
else if (geteuid() == 0 && [@"root" isEqualToString: NSUserName()] == NO)
|
||||
{
|
||||
att = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
NSFileOwnerAccountName, NSUserName(), nil];
|
||||
if ([mgr changeFileAttributes: att atPath: path] == NO)
|
||||
{
|
||||
NSWarnMLog(@"Unable to correctly set ownership for '%@'", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1963,6 +1972,7 @@ failure:
|
|||
* attributes match that of the original.
|
||||
*/
|
||||
[mAtt removeObjectForKey: NSFileSize];
|
||||
[mAtt removeObjectForKey: NSFileCreationDate];
|
||||
[mAtt removeObjectForKey: NSFileModificationDate];
|
||||
[mAtt removeObjectForKey: NSFileReferenceCount];
|
||||
[mAtt removeObjectForKey: NSFileSystemNumber];
|
||||
|
@ -1971,14 +1981,14 @@ failure:
|
|||
[mAtt removeObjectForKey: NSFileType];
|
||||
if ([mgr changeFileAttributes: mAtt atPath: path] == NO)
|
||||
{
|
||||
NSWarnMLog(@"Unable to correctly set all attributes for '%@'",
|
||||
path);
|
||||
NSWarnMLog(@"Unable to correctly set attributes for '%@' to %@",
|
||||
path, mAtt);
|
||||
}
|
||||
}
|
||||
else if (geteuid() == 0 && [@"root" isEqualToString: NSUserName()] == NO)
|
||||
{
|
||||
att = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
NSFileOwnerAccountName, NSUserName(), nil];
|
||||
NSFileOwnerAccountName, NSUserName(), nil];
|
||||
if ([mgr changeFileAttributes: att atPath: path] == NO)
|
||||
{
|
||||
NSWarnMLog(@"Unable to correctly set ownership for '%@'", path);
|
||||
|
|
Loading…
Reference in a new issue