From 982982f631e31c83a13362bdc285e7ea7e1abd1b Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 10 Aug 2012 14:31:28 +0000 Subject: [PATCH] temporary directory improvement git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35393 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/NSPathUtilities.m | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9635da3d..2762770b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-08-10 Richard Frith-Macdonald + + * Source/NSPathUtilities.m: + Fix permissions on temporary directory rarther than just failing ... + suggestion by Wolfgang. + 2012-08-10 Richard Frith-Macdonald * Source/NSFileManager.m: ([-createDirectoryAtPath:attributes:]) diff --git a/Source/NSPathUtilities.m b/Source/NSPathUtilities.m index d36a068bd..81e8de2a1 100644 --- a/Source/NSPathUtilities.m +++ b/Source/NSPathUtilities.m @@ -1989,6 +1989,10 @@ NSTemporaryDirectory(void) if ((perm != 0700 && perm != 0600) || owner != uid) { NSString *secure; + NSNumber *p = [NSNumber numberWithInt: 0700]; + + attr = [NSDictionary dictionaryWithObject: p + forKey: NSFilePosixPermissions]; /* * The name of the secure subdirectory reflects the user ID rather @@ -2003,10 +2007,6 @@ NSTemporaryDirectory(void) if ([manager fileExistsAtPath: tempDirName] == NO) { - NSNumber *p = [NSNumber numberWithInt: 0700]; - - attr = [NSDictionary dictionaryWithObject: p - forKey: NSFilePosixPermissions]; if ([manager createDirectoryAtPath: tempDirName withIntermediateDirectories: YES attributes: attr @@ -2017,6 +2017,10 @@ NSTemporaryDirectory(void) return nil; } } + else + { + [manager changeFileAttributes: attr atPath: tempDirName]; + } /* * Check that the new directory is really secure.