mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
As suggested by @matu3ba, it can be better to use Security Attributes directly while creating the handle instead of creating the handle then setting the handle to inherit. Doing so can prevent potentially leaking to other parallel spawned processes which would inherit the opened `\Device\Null` handle. This change also allows windows.OpenFile to handle when bInheritHandle is set. Note that we are using the same `saAttr`, but since it's taken as a pointer to a const in all calls, it's never mutated, and OpenFile never alters it. This also saves 1 kernel call for setting the handle to inherit.