@@ -20,10 +20,14 @@ #ifdef HAVE_FCNTL_H # include #endif #include "unistd_wrapper.h" + +#ifdef HAVE_SYS_STAT_H +# include +#endif #import "OFFile.h" #import "OFString.h" #import "OFLocalization.h" @@ -67,25 +71,10 @@ #endif #ifndef O_EXLOCK # define O_EXLOCK 0 #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 - #if !defined(OF_MORPHOS) || defined(OF_IXEMUL) static int parseMode(const char *mode) { if (strcmp(mode, "r") == 0) @@ -225,17 +214,17 @@ flags |= O_CLOEXEC; # if defined(OF_WINDOWS) if ((_fd = _wopen([path UTF16String], flags, - DEFAULT_MODE)) == -1) + _S_IREAD | _S_IWRITE)) == -1) # elif defined(OF_HAVE_OFF64_T) if ((_fd = open64([path cStringWithEncoding: - [OFLocalization encoding]], flags, DEFAULT_MODE)) == -1) + [OFLocalization encoding]], flags, 0666)) == -1) # else if ((_fd = open([path cStringWithEncoding: - [OFLocalization encoding]], flags, DEFAULT_MODE)) == -1) + [OFLocalization encoding]], flags, 0666)) == -1) # endif @throw [OFOpenItemFailedException exceptionWithPath: path mode: mode errNo: errno];