fusefrontend: fix RENAME_NOREPLACE darwin build failure

Error was:

internal/fusefrontend/node.go:371:2: duplicate case syscallcompat.RENAME_NOREPLACE (value 0) in switch
	previous case at internal/fusefrontend/node.go:368:7

Rewrite using "if"s instead.
This commit is contained in:
Jakob Unterwurzacher 2021-05-15 17:19:49 +02:00
parent 1ba2e42234
commit a91ad29d36

View File

@ -364,18 +364,17 @@ func (n *Node) Symlink(ctx context.Context, target, name string, out *fuse.Entry
// Reject those flags with syscall.EINVAL. // Reject those flags with syscall.EINVAL.
// If we can handle the flags, this function returns 0. // If we can handle the flags, this function returns 0.
func rejectRenameFlags(flags uint32) syscall.Errno { func rejectRenameFlags(flags uint32) syscall.Errno {
switch flags { // Normal rename, we can handle that
case 0: if flags == 0 {
// Normal rename, we can handle that
return 0 return 0
case syscallcompat.RENAME_NOREPLACE:
// We also can handle RENAME_NOREPLACE
return 0
default:
// We cannot handle RENAME_EXCHANGE and RENAME_WHITEOUT yet -
// needs extra code for .name files.
return syscall.EINVAL
} }
// We also can handle RENAME_NOREPLACE
if flags == syscallcompat.RENAME_NOREPLACE {
return 0
}
// We cannot handle RENAME_EXCHANGE and RENAME_WHITEOUT yet.
// Needs extra code for .name files.
return syscall.EINVAL
} }
// Rename - FUSE call. // Rename - FUSE call.