Name: akC57697 Date: 04/23/98
The java.io.File.mkdir() ignores umask settings when creates a directory.
The reason is a hard-coded mask in source of native method:
"
Java_java_io_File_mkdir0(JNIEnv *env, jobject this)
{
.........................
result = JVM_Mkdir(platformPath, 0771) != -1;
^^^^^
"
---------------------8-<----------------------
public class testFile {
public static void main(String argv[]) {
java.io.File f= new java.io.File("test_dir");
f.mkdir();
}
}
--------------------->-8----------------------
Set umask to -rw-rw-r--
umask 2
java testFile
drwxrwx--x 2 kuzm 512 Apr 23 13:58 test_dir/
^^^^^^^^^^
======================================================================
- duplicates
-
JDK-1263792 java.io: Not relying on umask in open/create/mkdir
- Resolved