You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4895 Reporter: gerd Status: closed (set by @xavierleroy on 2013-08-31T10:48:40Z) Resolution: fixed Priority: normal Severity: minor Version: 3.11.1 Fixed in version: 3.13.0+dev Category: ~DO NOT USE (was: OCaml general) Related to:#5416 Monitored by:@Chris00 "Christoph Bauer"
Bug description
The implementation of Unix.set/clear_close_on_exec creates a duplicate of the file handler, and changes the inheritance flag while doing so. The duplication changes the value of the descriptor, and is unnecessary, as Windows now supports changing the inheritance flag directly.
E.g.
let h = Hashtbl.create 10;;
Hashtbl.add h fd "Something";;
Unix.set_close_on_exec fd;;
Hashtbl.find h fd
raises Not_found
Additional information
use the win32 call SetHandleInformation
The text was updated successfully, but these errors were encountered:
SetHandleInformation is a relatively recent addition to Win32
(since Windows 2000 Professional / Server), so at the time this code was written there was probably no other option than duplicating the handle. I guess we can assume everyone has SetHandleInformation nowadays.
Original bug ID: 4895
Reporter: gerd
Status: closed (set by @xavierleroy on 2013-08-31T10:48:40Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.1
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #5416
Monitored by: @Chris00 "Christoph Bauer"
Bug description
The implementation of Unix.set/clear_close_on_exec creates a duplicate of the file handler, and changes the inheritance flag while doing so. The duplication changes the value of the descriptor, and is unnecessary, as Windows now supports changing the inheritance flag directly.
E.g.
let h = Hashtbl.create 10;;
Hashtbl.add h fd "Something";;
Unix.set_close_on_exec fd;;
Hashtbl.find h fd
raises Not_found
Additional information
use the win32 call SetHandleInformation
The text was updated successfully, but these errors were encountered: