Commit c326c636 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 8

Special-case /dev/null in open in the portability header

Summary: `/dev/null` doesn't exist on Windows, but thankfully, `NUL` does, and has the same semantics.

Reviewed By: meyering

Differential Revision: D3698007

fbshipit-source-id: 5ef31c6576f988dd747ea3c39e296c244bc640b7
parent aee84333
......@@ -96,6 +96,11 @@ int open(char const* fn, int of, int pm) {
// none are.
return -1;
}
if (!strcmp(fn, "/dev/null")) {
// Windows doesn't have a /dev/null, but it does have
// NUL, which achieves the same result.
fn = "NUL";
}
errno_t res = _sopen_s(&fh, fn, of, _SH_DENYNO, realMode);
return res ? -1 : fh;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment