| ... | ... | @@ -3525,7 +3525,7 @@ fn dirCreateFileAtomic( |
| 3525 | 3525 | if (dest_dirname) |dirname| { |
| 3526 | 3526 | // This has a nice side effect of preemptively triggering EISDIR or |
| 3527 | 3527 | // ENOENT, avoiding the ambiguity below. |
| 3528 | | dir.createDirPath(t_io, dirname) catch |err| switch (err) { |
| 3528 | if (options.make_path) dir.createDirPath(t_io, dirname) catch |err| switch (err) { |
| 3529 | 3529 | // None of these make sense in this context. |
| 3530 | 3530 | error.IsDir, |
| 3531 | 3531 | error.Streaming, |
| ... | ... | @@ -5254,7 +5254,16 @@ fn fileHardLink( |
| 5254 | 5254 | else |
| 5255 | 5255 | posix.AT.EMPTY_PATH; |
| 5256 | 5256 | |
| 5257 | | return linkat(file.handle, "", new_dir.handle, new_sub_path_posix, flags); |
| 5257 | return linkat(file.handle, "", new_dir.handle, new_sub_path_posix, flags) catch |err| switch (err) { |
| 5258 | error.FileNotFound => { |
| 5259 | if (options.follow_symlinks) return error.FileNotFound; |
| 5260 | var proc_buf: ["/proc/self/fd/-2147483648\x00".len]u8 = undefined; |
| 5261 | const proc_path = std.fmt.bufPrintSentinel(&proc_buf, "/proc/self/fd/{d}", .{file.handle}, 0) catch |
| 5262 | unreachable; |
| 5263 | return linkat(posix.AT.FDCWD, proc_path, new_dir.handle, new_sub_path_posix, posix.AT.SYMLINK_FOLLOW); |
| 5264 | }, |
| 5265 | else => |e| return e, |
| 5266 | }; |
| 5258 | 5267 | } |
| 5259 | 5268 | |
| 5260 | 5269 | fn linkat( |