diff options
author | Rickard Green <[email protected]> | 2013-02-14 17:41:02 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2013-02-14 17:41:02 +0100 |
commit | 816e1e40b0c1e5767bec9b3a9d3aed46969b153a (patch) | |
tree | 6e3f927443e90e14d2c41f55055d459a972c4492 | |
parent | 08dde65f70ef2b2218e9350bb4013b40aed65996 (diff) | |
parent | 81ec60cb9eae5cebdef2fa4f5a65b7633fd37598 (diff) | |
download | otp-816e1e40b0c1e5767bec9b3a9d3aed46969b153a.tar.gz otp-816e1e40b0c1e5767bec9b3a9d3aed46969b153a.tar.bz2 otp-816e1e40b0c1e5767bec9b3a9d3aed46969b153a.zip |
Merge branch 'rickard/win-drv-bugfix/OTP-10802'
* rickard/win-drv-bugfix/OTP-10802:
Fix unsafe driver_select() from win32 vanilla/spawn drivers
-rwxr-xr-x | erts/emulator/sys/win32/sys.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/erts/emulator/sys/win32/sys.c b/erts/emulator/sys/win32/sys.c index f7756f99bc..4eb5c0e8d3 100755 --- a/erts/emulator/sys/win32/sys.c +++ b/erts/emulator/sys/win32/sys.c @@ -749,7 +749,6 @@ static void close_active_handle(ErlDrvPort port_num, HANDLE handle) CloseHandle(thread); } htbc->handles[htbc->cnt++] = handle; - driver_select(port_num, (ErlDrvEvent)handle, ERL_DRV_USE_NO_CALLBACK, 0); SetEvent(htbc->handles[0]); htbc_curr = htbc; LeaveCriticalSection(&htbc_lock); @@ -914,12 +913,8 @@ release_async_io(AsyncIo* aio, ErlDrvPort port_num) CloseHandle(aio->fd); aio->fd = INVALID_HANDLE_VALUE; - if (aio->ov.hEvent != NULL) { - (void) driver_select(port_num, - (ErlDrvEvent)aio->ov.hEvent, - ERL_DRV_USE, 0); - /* was CloseHandle(aio->ov.hEvent); */ - } + if (aio->ov.hEvent != NULL) + CloseHandle(aio->ov.hEvent); aio->ov.hEvent = NULL; @@ -2349,12 +2344,12 @@ stop(ErlDrvData data) if (dp->in.ov.hEvent != NULL) { (void) driver_select(dp->port_num, (ErlDrvEvent)dp->in.ov.hEvent, - ERL_DRV_READ, 0); + ERL_DRV_READ|ERL_DRV_USE_NO_CALLBACK, 0); } if (dp->out.ov.hEvent != NULL) { (void) driver_select(dp->port_num, (ErlDrvEvent)dp->out.ov.hEvent, - ERL_DRV_WRITE, 0); + ERL_DRV_WRITE|ERL_DRV_USE_NO_CALLBACK, 0); } if (dp->out.thread == (HANDLE) -1 && dp->in.thread == (HANDLE) -1) { |