From a91ad29d362e8cb5348766da637202ac8905b9f2 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 15 May 2021 17:19:49 +0200 Subject: [PATCH] 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. --- internal/fusefrontend/node.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go index 543926d..87effca 100644 --- a/internal/fusefrontend/node.go +++ b/internal/fusefrontend/node.go @@ -364,18 +364,17 @@ func (n *Node) Symlink(ctx context.Context, target, name string, out *fuse.Entry // Reject those flags with syscall.EINVAL. // If we can handle the flags, this function returns 0. func rejectRenameFlags(flags uint32) syscall.Errno { - switch flags { - case 0: - // Normal rename, we can handle that + // Normal rename, we can handle that + if flags == 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.