From 1dc932618fa03430e72b448e0319e1777927f1ad Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Fri, 6 Dec 2013 22:22:16 -0700 Subject: [PATCH] Use 0777/0666 permissions when creating dirs/files. Just like openjdk, we now depend on the processes umask (0022, for instance) to mask that into 0755 or 0666, for instance. This fixes #57. --- classpath/java-io.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index e6f7f8a55d..4755fe8962 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -350,7 +350,7 @@ Java_java_io_File_mkdir(JNIEnv* e, jclass, jstring path) string_t chars = getChars(e, path); if (chars) { if (not exists(chars)) { - int r = ::MKDIR(chars, 0700); + int r = ::MKDIR(chars, 0777); if (r != 0) { throwNewErrno(e, "java/io/IOException"); } @@ -366,7 +366,7 @@ Java_java_io_File_createNewFile(JNIEnv* e, jclass, jstring path) string_t chars = getChars(e, path); if (chars) { if (not exists(chars)) { - int fd = OPEN(chars, O_CREAT | O_WRONLY | O_EXCL, 0600); + int fd = OPEN(chars, O_CREAT | O_WRONLY | O_EXCL, 0666); if (fd == -1) { if (errno != EEXIST) { throwNewErrno(e, "java/io/IOException"); @@ -818,7 +818,7 @@ Java_java_io_RandomAccessFile_open(JNIEnv* e, jclass, jstring path, #if defined(PLATFORM_WINDOWS) int fd = ::_wopen(chars, flags); #else - int fd = ::open((const char*)chars, flags, 0644); + int fd = ::open((const char*)chars, flags, 0666); #endif releaseChars(e, path, chars); if (fd == -1) {