4023 } |
4023 } |
4024 |
4024 |
4025 // This code originates from JDK's sysOpen and open64_w |
4025 // This code originates from JDK's sysOpen and open64_w |
4026 // from src/solaris/hpi/src/system_md.c |
4026 // from src/solaris/hpi/src/system_md.c |
4027 |
4027 |
4028 #ifndef O_DELETE |
|
4029 #define O_DELETE 0x10000 |
|
4030 #endif |
|
4031 |
|
4032 // Open a file. Unlink the file immediately after open returns |
|
4033 // if the specified oflag has the O_DELETE flag set. |
|
4034 // O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c |
|
4035 |
|
4036 int os::open(const char *path, int oflag, int mode) { |
4028 int os::open(const char *path, int oflag, int mode) { |
4037 |
4029 |
4038 if (strlen(path) > MAX_PATH - 1) { |
4030 if (strlen(path) > MAX_PATH - 1) { |
4039 errno = ENAMETOOLONG; |
4031 errno = ENAMETOOLONG; |
4040 return -1; |
4032 return -1; |
4041 } |
4033 } |
4042 int fd; |
4034 int fd; |
4043 int o_delete = (oflag & O_DELETE); |
|
4044 oflag = oflag & ~O_DELETE; |
|
4045 |
4035 |
4046 fd = ::open64(path, oflag, mode); |
4036 fd = ::open64(path, oflag, mode); |
4047 if (fd == -1) return -1; |
4037 if (fd == -1) return -1; |
4048 |
4038 |
4049 // If the open succeeded, the file might still be a directory. |
4039 // If the open succeeded, the file might still be a directory. |