8053931: (fc) FileDispatcherImpl.lock0 does not handle ERROR_IO_PENDING [win]

Reviewed-by: alanb
This commit is contained in:
Martin Doerr 2014-08-01 15:50:01 +01:00 committed by Alan Bateman
parent 96c0091bde
commit 269f961b6d

View File

@ -406,6 +406,14 @@ Java_sun_nio_ch_FileDispatcherImpl_lock0(JNIEnv *env, jobject this, jobject fdo,
result = LockFileEx(h, flags, 0, lowNumBytes, highNumBytes, &o);
if (result == 0) {
int error = GetLastError();
if (error == ERROR_IO_PENDING) {
LPDWORD dwBytes;
result = GetOverlappedResult(h, &o, &dwBytes, TRUE);
if (result != 0) {
return sun_nio_ch_FileDispatcherImpl_LOCKED;
}
error = GetLastError();
}
if (error != ERROR_LOCK_VIOLATION) {
JNU_ThrowIOExceptionWithLastError(env, "Lock failed");
return sun_nio_ch_FileDispatcherImpl_NO_LOCK;