authorgravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-24 11:19:09-02:00
committergravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-24 11:45:55-02:00
log52be7d7404acf2eff53d5c0cfd3ddeb591a5e27c
tree312534f55ce13dc88001a0d549541076088bcd36
parentde473d442371c943bff077428b3786885cadec47

freebsd: fix flags for opening files

Prior to this fix, the compare-outputs test suite was showing a strange behavior, the tests always stopped between tests 6-8 and had a stack track similar to each other. ``` Test 8/68 compare-output multiple files with private function (ReleaseSmall)...OK /usr/home/mgxm/dev/zig/zig-cache/source.zig:7:2: error: invalid token: '&' }&(getStdOut() catch unreachable).outStream().stream; ^ The following command exited with error code 1: ``` With the wrong O_* flags, the source code was being written in append mode which resulted in an invalid file ```zig use @import("foo.zig"); use @import("bar.zig"); pub fn main() void { foo_function(); bar_function(); }&(getStdOut() catch unreachable).outStream().stream; stdout.print("OK 2\n") catch unreachable; } fn privateFunction() void { printText(); } ```

1 files changed, 16 insertions(+), 16 deletions(-)

std/os/freebsd/index.zig+16-16
...@@ -105,26 +105,26 @@ pub const W_OK = 2; // test for write permission...@@ -105,26 +105,26 @@ pub const W_OK = 2; // test for write permission
105pub const R_OK = 4; // test for read permission105pub const R_OK = 4; // test for read permission
106106
107107
108pub const O_RDONLY = 0o0;108pub const O_RDONLY = 0x0000;
109pub const O_WRONLY = 0o1;109pub const O_WRONLY = 0x0001;
110pub const O_RDWR = 0o2;110pub const O_RDWR = 0x0002;
111pub const O_ACCMODE = 0o3;111pub const O_ACCMODE = 0x0003;
112112
113pub const O_CREAT = 0o100;113pub const O_CREAT = 0x0200;
114pub const O_EXCL = 0o200;114pub const O_EXCL = 0x0800;
115pub const O_NOCTTY = 0o400;115pub const O_NOCTTY = 0x8000;
116pub const O_TRUNC = 0o1000;116pub const O_TRUNC = 0x0400;
117pub const O_APPEND = 0o2000;117pub const O_APPEND = 0x0008;
118pub const O_NONBLOCK = 0o4000;118pub const O_NONBLOCK = 0x0004;
119pub const O_DSYNC = 0o10000;119pub const O_DSYNC = 0o10000;
120pub const O_SYNC = 0o4010000;120pub const O_SYNC = 0x0080;
121pub const O_RSYNC = 0o4010000;121pub const O_RSYNC = 0o4010000;
122pub const O_DIRECTORY = 0o200000;122pub const O_DIRECTORY = 0o200000;
123pub const O_NOFOLLOW = 0o400000;123pub const O_NOFOLLOW = 0x0100;
124pub const O_CLOEXEC = 0o2000000;124pub const O_CLOEXEC = 0x00100000;
125125
126pub const O_ASYNC = 0o20000;126pub const O_ASYNC = 0x0040;
127pub const O_DIRECT = 0o40000;127pub const O_DIRECT = 0x00010000;
128pub const O_LARGEFILE = 0;128pub const O_LARGEFILE = 0;
129pub const O_NOATIME = 0o1000000;129pub const O_NOATIME = 0o1000000;
130pub const O_PATH = 0o10000000;130pub const O_PATH = 0o10000000;