diff options
author | 2022-04-03 16:34:38 -0700 | |
---|---|---|
committer | 2022-04-03 16:34:38 -0700 | |
commit | e8b2af1eaeabe4919bb239217e1c4b634929eade (patch) | |
tree | 50a292c3c3107647fc920d2254478b06325bd863 | |
parent | 4d718931be688333dccfc2bbe80de6faa26a0ce1 (diff) | |
download | bun-e8b2af1eaeabe4919bb239217e1c4b634929eade.tar.gz bun-e8b2af1eaeabe4919bb239217e1c4b634929eade.tar.zst bun-e8b2af1eaeabe4919bb239217e1c4b634929eade.zip |
doesn't fix the bug but helps a little
-rw-r--r-- | src/libarchive/libarchive.zig | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libarchive/libarchive.zig b/src/libarchive/libarchive.zig index 34ffbedb4..749404037 100644 --- a/src/libarchive/libarchive.zig +++ b/src/libarchive/libarchive.zig @@ -14,6 +14,7 @@ const default_allocator = bun.default_allocator; const C = bun.C; const std = @import("std"); const struct_archive = lib.struct_archive; +const JSC = @import("javascript_core"); pub const Seek = enum(c_int) { set = std.os.SEEK_SET, current = std.os.SEEK_CUR, @@ -515,7 +516,7 @@ pub const Archive = struct { std.os.mkdiratZ(dir.fd, pathname, perm) catch |err| { if (err == error.PathAlreadyExists or err == error.NotDir) break; try dir.makePath(std.fs.path.dirname(slice) orelse return err); - try std.os.mkdiratZ(dir.fd, pathname, perm); + try std.os.mkdiratZ(dir.fd, pathname, 0o777); }; }, Kind.SymLink => { @@ -523,8 +524,8 @@ pub const Archive = struct { std.os.symlinkatZ(link_target, dir.fd, pathname) catch |err| brk: { switch (err) { - error.FileNotFound => { - try dir.makePath(std.fs.path.dirname(slice) orelse return err); + error.AccessDenied, error.FileNotFound => { + dir.makePath(std.fs.path.dirname(slice) orelse return err) catch {}; break :brk try std.os.symlinkatZ(link_target, dir.fd, pathname); }, else => { @@ -536,9 +537,11 @@ pub const Archive = struct { Kind.File => { const file = dir.createFileZ(pathname, .{ .truncate = true, .mode = @intCast(std.os.mode_t, lib.archive_entry_perm(entry)) }) catch |err| brk: { switch (err) { - error.FileNotFound => { - try dir.makePath(std.fs.path.dirname(slice) orelse return err); - break :brk try dir.createFileZ(pathname, .{ .truncate = true }); + error.AccessDenied, error.FileNotFound => { + dir.makePath(std.fs.path.dirname(slice) orelse return err) catch {}; + break :brk try dir.createFileZ(pathname, .{ + .truncate = true, + }); }, else => { return err; |