3843 } |
3843 } |
3844 |
3844 |
3845 // This code originates from JDK's sysOpen and open64_w |
3845 // This code originates from JDK's sysOpen and open64_w |
3846 // from src/solaris/hpi/src/system_md.c |
3846 // from src/solaris/hpi/src/system_md.c |
3847 |
3847 |
3848 #ifndef O_DELETE |
|
3849 #define O_DELETE 0x10000 |
|
3850 #endif |
|
3851 |
|
3852 // Open a file. Unlink the file immediately after open returns |
|
3853 // if the specified oflag has the O_DELETE flag set. |
|
3854 // O_DELETE is used only in j2se/src/share/native/java/util/zip/ZipFile.c |
|
3855 |
|
3856 int os::open(const char *path, int oflag, int mode) { |
3848 int os::open(const char *path, int oflag, int mode) { |
3857 if (strlen(path) > MAX_PATH - 1) { |
3849 if (strlen(path) > MAX_PATH - 1) { |
3858 errno = ENAMETOOLONG; |
3850 errno = ENAMETOOLONG; |
3859 return -1; |
3851 return -1; |
3860 } |
3852 } |
3861 int fd; |
3853 int fd; |
3862 int o_delete = (oflag & O_DELETE); |
|
3863 oflag = oflag & ~O_DELETE; |
|
3864 |
3854 |
3865 fd = ::open(path, oflag, mode); |
3855 fd = ::open(path, oflag, mode); |
3866 if (fd == -1) return -1; |
3856 if (fd == -1) return -1; |
3867 |
3857 |
3868 // If the open succeeded, the file might still be a directory |
3858 // If the open succeeded, the file might still be a directory |