equal
deleted
inserted
replaced
145 int result = 0; |
145 int result = 0; |
146 |
146 |
147 if (md == JNI_FALSE) { |
147 if (md == JNI_FALSE) { |
148 result = fdatasync(fd); |
148 result = fdatasync(fd); |
149 } else { |
149 } else { |
|
150 #ifdef _AIX |
|
151 /* On AIX, calling fsync on a file descriptor that is opened only for |
|
152 * reading results in an error ("EBADF: The FileDescriptor parameter is |
|
153 * not a valid file descriptor open for writing."). |
|
154 * However, at this point it is not possibly anymore to read the |
|
155 * 'writable' attribute of the corresponding file channel so we have to |
|
156 * use 'fcntl'. |
|
157 */ |
|
158 int getfl = fcntl(fd, F_GETFL); |
|
159 if (getfl >= 0 && (getfl & O_ACCMODE) == O_RDONLY) { |
|
160 return 0; |
|
161 } |
|
162 #endif |
150 result = fsync(fd); |
163 result = fsync(fd); |
151 } |
164 } |
152 return handle(env, result, "Force failed"); |
165 return handle(env, result, "Force failed"); |
153 } |
166 } |
154 |
167 |