authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-08-24 02:28:31+10:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-08-24 02:28:31+10:00
log129d3e274dbc3e11a30e3d54c5da7a944ddcf4f0
tree386d6b361b9fb75ebb8d09f0e4aeb817cb6aa38c
parent23a81b439638fee89054ad749f0348ab7d107619
signature Commit is signed but in an unrecognized format.

std: use O_NOCTTY flag


2 files changed, 7 insertions(+), 0 deletions(-)

lib/std/fs.zig+3
...@@ -704,6 +704,9 @@ pub const Dir = struct {...@@ -704,6 +704,9 @@ pub const Dir = struct {
704 if (@hasDecl(os, "O_LARGEFILE")) {704 if (@hasDecl(os, "O_LARGEFILE")) {
705 os_flags |= os.O_LARGEFILE;705 os_flags |= os.O_LARGEFILE;
706 }706 }
707 if (!flags.allow_ctty) {
708 os_flags |= os.O_NOCTTY;
709 }
707 os_flags |= if (flags.write and flags.read)710 os_flags |= if (flags.write and flags.read)
708 @as(u32, os.O_RDWR)711 @as(u32, os.O_RDWR)
709 else if (flags.write)712 else if (flags.write)
lib/std/fs/file.zig+4
...@@ -101,6 +101,10 @@ pub const File = struct {...@@ -101,6 +101,10 @@ pub const File = struct {
101 /// if `std.io.is_async`. It allows the use of `nosuspend` when calling functions101 /// if `std.io.is_async`. It allows the use of `nosuspend` when calling functions
102 /// related to opening the file, reading, writing, and locking.102 /// related to opening the file, reading, writing, and locking.
103 intended_io_mode: io.ModeOverride = io.default_mode,103 intended_io_mode: io.ModeOverride = io.default_mode,
104
105 /// Set this to allow the opened file to automatically become the
106 /// controlling TTY for the current process.
107 allow_ctty: bool = false,
104 };108 };
105109
106 /// TODO https://github.com/ziglang/zig/issues/3802110 /// TODO https://github.com/ziglang/zig/issues/3802