Add safe immutable directory promotion
This commit is contained in:
9
internal/fileops/rename_noreplace_linux.go
Normal file
9
internal/fileops/rename_noreplace_linux.go
Normal file
@@ -0,0 +1,9 @@
|
||||
//go:build linux
|
||||
|
||||
package fileops
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func renameDirectoryNoReplace(src, dst string) error {
|
||||
return unix.Renameat2(unix.AT_FDCWD, src, unix.AT_FDCWD, dst, unix.RENAME_NOREPLACE)
|
||||
}
|
||||
Reference in New Issue
Block a user