@@ -69,26 +69,10 @@ # include # include # include #endif -#ifndef S_IRGRP -# define S_IRGRP 0 -#endif -#ifndef S_IROTH -# define S_IROTH 0 -#endif -#ifndef S_IWGRP -# define S_IWGRP 0 -#endif -#ifndef S_IWOTH -# define S_IWOTH 0 -#endif - -#define DEFAULT_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH -#define DIR_MODE DEFAULT_MODE | S_IXUSR | S_IXGRP | S_IXOTH - #if defined(OF_WINDOWS) typedef struct __stat64 of_stat_t; #elif defined(OF_HAVE_OFF64_T) typedef struct stat64 of_stat_t; #else @@ -277,11 +261,11 @@ if (path == nil) @throw [OFInvalidArgumentException exception]; #ifndef OF_WINDOWS if (mkdir([path cStringWithEncoding: [OFLocalization encoding]], - DIR_MODE) != 0) + 0777) != 0) #else if (_wmkdir([path UTF16String]) != 0) #endif @throw [OFCreateDirectoryFailedException exceptionWithPath: path @@ -515,11 +499,11 @@ /* FIXME: We could be more precise on some OSes */ return [OFDate dateWithTimeIntervalSince1970: s.st_ctime]; } #ifdef OF_HAVE_CHMOD -- (mode_t)permissionsOfItemAtPath: (OFString *)path +- (uint16_t)permissionsOfItemAtPath: (OFString *)path { of_stat_t s; if (path == nil) @throw [OFInvalidArgumentException exception]; @@ -526,18 +510,20 @@ if (of_stat(path, &s) != 0) @throw [OFStatItemFailedException exceptionWithPath: path errNo: errno]; - return s.st_mode; + return s.st_mode & 07777; } - (void)changePermissionsOfItemAtPath: (OFString *)path - permissions: (mode_t)permissions + permissions: (uint16_t)permissions { if (path == nil) @throw [OFInvalidArgumentException exception]; + + permissions &= 0777; # ifndef OF_WINDOWS if (chmod([path cStringWithEncoding: [OFLocalization encoding]], permissions) != 0) # else