| ... | @@ -7756,7 +7756,14 @@ fn dirRenamePreserve( | ... | @@ -7756,7 +7756,14 @@ fn dirRenamePreserve( |
| 7756 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 7756 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 7757 | if (is_windows) return dirRenameWindowsInner(old_dir, old_sub_path, new_dir, new_sub_path, false); | 7757 | if (is_windows) return dirRenameWindowsInner(old_dir, old_sub_path, new_dir, new_sub_path, false); |
| 7758 | if (is_darwin) return dirRenamePreserveDarwin(old_dir, old_sub_path, new_dir, new_sub_path); | 7758 | if (is_darwin) return dirRenamePreserveDarwin(old_dir, old_sub_path, new_dir, new_sub_path); |
| 7759 | if (native_os == .linux) return dirRenamePreserveLinux(old_dir, old_sub_path, new_dir, new_sub_path); | 7759 | if (native_os == .linux) { |
| | 7760 | if (dirRenamePreserveLinux(old_dir, old_sub_path, new_dir, new_sub_path)) |_| { |
| | 7761 | return; |
| | 7762 | } else |err| switch (err) { |
| | 7763 | else => |e| return e, |
| | 7764 | error.OperationUnsupported => {}, // Fall back to link/unlink below. |
| | 7765 | } |
| | 7766 | } |
| 7760 | // Make a hard link then delete the original. | 7767 | // Make a hard link then delete the original. |
| 7761 | try dirHardLink(t, old_dir, old_sub_path, new_dir, new_sub_path, .{ .follow_symlinks = false }); | 7768 | try dirHardLink(t, old_dir, old_sub_path, new_dir, new_sub_path, .{ .follow_symlinks = false }); |
| 7762 | const prev = swapCancelProtection(t, .blocked); | 7769 | const prev = swapCancelProtection(t, .blocked); |
| ... | @@ -8084,8 +8091,10 @@ fn dirRenamePreserveLinux( | ... | @@ -8084,8 +8091,10 @@ fn dirRenamePreserveLinux( |
| 8084 | .ROFS => return syscall.fail(error.ReadOnlyFileSystem), | 8091 | .ROFS => return syscall.fail(error.ReadOnlyFileSystem), |
| 8085 | .XDEV => return syscall.fail(error.CrossDevice), | 8092 | .XDEV => return syscall.fail(error.CrossDevice), |
| 8086 | .ILSEQ => return syscall.fail(error.BadPathName), | 8093 | .ILSEQ => return syscall.fail(error.BadPathName), |
| | 8094 | // EINVAL when passing NOREPLACE=true observed on ext4, 7.0.0-38-generic #38~24.04.4-Ubuntu. |
| | 8095 | // OPNOTSUPP handled defensively. |
| | 8096 | .INVAL, .OPNOTSUPP => return syscall.fail(error.OperationUnsupported), |
| 8087 | .FAULT => |err| return syscall.errnoBug(err), | 8097 | .FAULT => |err| return syscall.errnoBug(err), |
| 8088 | .INVAL => return syscall.fail(error.OperationUnsupported), | | |
| 8089 | else => |err| return syscall.unexpectedErrno(err), | 8098 | else => |err| return syscall.unexpectedErrno(err), |
| 8090 | }; | 8099 | }; |
| 8091 | } | 8100 | } |