commit 52be7d7404acf2eff53d5c0cfd3ddeb591a5e27c (tree)
parent de473d442371c943bff077428b3786885cadec47
Author: Marcio Giaxa <i@mgxm.me>
Date: Mon, 24 Dec 2018 11:19:09 -0200
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();
}
```
Diffstat:
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/std/os/freebsd/index.zig b/std/os/freebsd/index.zig
@@ -105,26 +105,26 @@ pub const W_OK = 2; // test for write permission
pub const R_OK = 4; // test for read permission
-pub const O_RDONLY = 0o0;
-pub const O_WRONLY = 0o1;
-pub const O_RDWR = 0o2;
-pub const O_ACCMODE = 0o3;
-
-pub const O_CREAT = 0o100;
-pub const O_EXCL = 0o200;
-pub const O_NOCTTY = 0o400;
-pub const O_TRUNC = 0o1000;
-pub const O_APPEND = 0o2000;
-pub const O_NONBLOCK = 0o4000;
+pub const O_RDONLY = 0x0000;
+pub const O_WRONLY = 0x0001;
+pub const O_RDWR = 0x0002;
+pub const O_ACCMODE = 0x0003;
+
+pub const O_CREAT = 0x0200;
+pub const O_EXCL = 0x0800;
+pub const O_NOCTTY = 0x8000;
+pub const O_TRUNC = 0x0400;
+pub const O_APPEND = 0x0008;
+pub const O_NONBLOCK = 0x0004;
pub const O_DSYNC = 0o10000;
-pub const O_SYNC = 0o4010000;
+pub const O_SYNC = 0x0080;
pub const O_RSYNC = 0o4010000;
pub const O_DIRECTORY = 0o200000;
-pub const O_NOFOLLOW = 0o400000;
-pub const O_CLOEXEC = 0o2000000;
+pub const O_NOFOLLOW = 0x0100;
+pub const O_CLOEXEC = 0x00100000;
-pub const O_ASYNC = 0o20000;
-pub const O_DIRECT = 0o40000;
+pub const O_ASYNC = 0x0040;
+pub const O_DIRECT = 0x00010000;
pub const O_LARGEFILE = 0;
pub const O_NOATIME = 0o1000000;
pub const O_PATH = 0o10000000;