diff options
author | 2022-11-12 01:05:42 +0100 | |
---|---|---|
committer | 2022-11-12 01:05:42 +0100 | |
commit | cafe22a28b3b5c1e5cdd65c40ff8ed41e19f666f (patch) | |
tree | ab5ba941b2af8981c400868f6629da6439e3d281 | |
parent | 206bb5d298e9d6c4e0b6dbc32d0a9ce9ec97082e (diff) | |
download | bun-cafe22a28b3b5c1e5cdd65c40ff8ed41e19f666f.tar.gz bun-cafe22a28b3b5c1e5cdd65c40ff8ed41e19f666f.tar.zst bun-cafe22a28b3b5c1e5cdd65c40ff8ed41e19f666f.zip |
Fix: octal has leading zeros
-rw-r--r-- | src/bun.js/node/node_fs.zig | 8 | ||||
-rw-r--r-- | src/c.zig | 4 | ||||
-rw-r--r-- | src/install/install.zig | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/bun.js/node/node_fs.zig b/src/bun.js/node/node_fs.zig index edbe71586..669537184 100644 --- a/src/bun.js/node/node_fs.zig +++ b/src/bun.js/node/node_fs.zig @@ -1524,7 +1524,7 @@ const Arguments = struct { pub const WriteFile = struct { encoding: Encoding = Encoding.utf8, flag: FileSystemFlags = FileSystemFlags.@"w", - mode: Mode = 0666, + mode: Mode = 0o666, file: PathOrFileDescriptor, data: StringOrBuffer, @@ -2395,7 +2395,7 @@ pub const NodeFS = struct { const path = path_.sliceZ(&this.sync_error_buf); switch (comptime flavor) { .sync => { - const fd = switch (Syscall.open(path, @enumToInt(FileSystemFlags.@"a"), 000666)) { + const fd = switch (Syscall.open(path, @enumToInt(FileSystemFlags.@"a"), 0o666)) { .result => |result| result, .err => |err| return .{ .err = err }, }; @@ -2480,7 +2480,7 @@ pub const NodeFS = struct { return ret.success; } } else { - const src_fd = switch (Syscall.open(src, std.os.O.RDONLY, 0644)) { + const src_fd = switch (Syscall.open(src, std.os.O.RDONLY, 0o644)) { .result => |result| result, .err => |err| return .{ .err = err.withPath(args.src.slice()) }, }; @@ -2579,7 +2579,7 @@ pub const NodeFS = struct { return Maybe(Return.CopyFile).todo; } - const src_fd = switch (Syscall.open(src, std.os.O.RDONLY, 0644)) { + const src_fd = switch (Syscall.open(src, std.os.O.RDONLY, 0o644)) { .result => |result| result, .err => |err| return .{ .err = err }, }; @@ -122,7 +122,7 @@ pub fn moveFileZWithHandle(from_handle: std.os.fd_t, from_dir: std.os.fd_t, file // On Linux, this will be fast because sendfile() supports copying between two file descriptors on disk // macOS & BSDs will be slow because pub fn moveFileZSlow(from_dir: std.os.fd_t, filename: [*:0]const u8, to_dir: std.os.fd_t, destination: [*:0]const u8) !void { - const in_handle = try std.os.openatZ(from_dir, filename, std.os.O.RDONLY | std.os.O.CLOEXEC, 0600); + const in_handle = try std.os.openatZ(from_dir, filename, std.os.O.RDONLY | std.os.O.CLOEXEC, 0o600); try moveFileZSlowWithHandle(in_handle, to_dir, destination); } @@ -133,7 +133,7 @@ pub fn moveFileZSlowWithHandle(in_handle: std.os.fd_t, to_dir: std.os.fd_t, dest // ftruncate() instead didn't work. // this is technically racy because it could end up deleting the file without saving std.os.unlinkatZ(to_dir, destination, 0) catch {}; - const out_handle = try std.os.openatZ(to_dir, destination, std.os.O.WRONLY | std.os.O.CREAT | std.os.O.CLOEXEC, 022); + const out_handle = try std.os.openatZ(to_dir, destination, std.os.O.WRONLY | std.os.O.CREAT | std.os.O.CLOEXEC, 0o22); defer std.os.close(out_handle); if (comptime Environment.isLinux) { _ = std.os.system.fallocate(out_handle, 0, 0, @intCast(i64, stat_.size)); diff --git a/src/install/install.zig b/src/install/install.zig index ea926197c..6c5e0a1a4 100644 --- a/src/install/install.zig +++ b/src/install/install.zig @@ -2480,7 +2480,7 @@ pub const PackageManager = struct { _ = C.fchmod( tmpfile.fd, // chmod 666, - 0000040 | 0000004 | 0000002 | 0000400 | 0000200 | 0000020, + 0o40 | 0o4 | 0o2 | 0o400 | 0o200 | 0o20, ); try tmpfile.promote(tmpname, std.fs.cwd().fd, "yarn.lock"); |