diff --git a/cmd/posix.go b/cmd/posix.go index d19d07dd2..bafebde07 100644 --- a/cmd/posix.go +++ b/cmd/posix.go @@ -19,6 +19,8 @@ package cmd import ( "bufio" "context" + "crypto/rand" + "encoding/hex" "errors" "io" "io/ioutil" @@ -154,12 +156,15 @@ func getValidPath(path string) (string, error) { } // check if backend is writable. - file, err := os.Create(pathJoin(path, ".writable-check.tmp")) + var rnd [8]byte + _, _ = rand.Read(rnd[:]) + fn := pathJoin(path, ".writable-check-"+hex.EncodeToString(rnd[:])+".tmp") + file, err := os.Create(fn) if err != nil { return path, err } - defer os.Remove(pathJoin(path, ".writable-check.tmp")) file.Close() + os.Remove(fn) return path, nil }