| ... | @@ -3430,6 +3430,17 @@ fn dirCreateFileAtomic( | ... | @@ -3430,6 +3430,17 @@ fn dirCreateFileAtomic( |
| 3430 | // useless when we have to make up a bogus path name to do the rename() | 3430 | // useless when we have to make up a bogus path name to do the rename() |
| 3431 | // anyway. | 3431 | // anyway. |
| 3432 | if (native_os == .linux and !options.replace) tmpfile: { | 3432 | if (native_os == .linux and !options.replace) tmpfile: { |
| | 3433 | const flags: posix.O = if (@hasField(posix.O, "TMPFILE")) .{ |
| | 3434 | .ACCMODE = .RDWR, |
| | 3435 | .TMPFILE = true, |
| | 3436 | .CLOEXEC = true, |
| | 3437 | } else if (@hasField(posix.O, "TMPFILE0") and !@hasField(posix.O, "TMPFILE2")) .{ |
| | 3438 | .ACCMODE = .RDWR, |
| | 3439 | .TMPFILE0 = true, |
| | 3440 | .TMPFILE1 = true, |
| | 3441 | .CLOEXEC = true, |
| | 3442 | } else break :tmpfile; |
| | 3443 | |
| 3433 | const dest_dirname = Dir.path.dirname(dest_path); | 3444 | const dest_dirname = Dir.path.dirname(dest_path); |
| 3434 | if (dest_dirname) |dirname| { | 3445 | if (dest_dirname) |dirname| { |
| 3435 | // This has a nice side effect of preemptively triggering EISDIR or | 3446 | // This has a nice side effect of preemptively triggering EISDIR or |
| ... | @@ -3456,12 +3467,6 @@ fn dirCreateFileAtomic( | ... | @@ -3456,12 +3467,6 @@ fn dirCreateFileAtomic( |
| 3456 | var path_buffer: [posix.PATH_MAX]u8 = undefined; | 3467 | var path_buffer: [posix.PATH_MAX]u8 = undefined; |
| 3457 | const sub_path_posix = try pathToPosix(dest_dirname orelse ".", &path_buffer); | 3468 | const sub_path_posix = try pathToPosix(dest_dirname orelse ".", &path_buffer); |
| 3458 | | 3469 | |
| 3459 | const flags: posix.O = .{ | | |
| 3460 | .ACCMODE = .RDWR, | | |
| 3461 | .TMPFILE = true, | | |
| 3462 | .CLOEXEC = true, | | |
| 3463 | }; | | |
| 3464 | | | |
| 3465 | const syscall: Syscall = try .start(); | 3470 | const syscall: Syscall = try .start(); |
| 3466 | while (true) { | 3471 | while (true) { |
| 3467 | const rc = openat_sym(dir.handle, sub_path_posix, flags, options.permissions.toMode()); | 3472 | const rc = openat_sym(dir.handle, sub_path_posix, flags, options.permissions.toMode()); |