From 8a1166c02145b8752a8c5f3d30a3451ff26f2865 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 8 Jun 2022 00:32:09 -0700 Subject: [PATCH] auto remove previous leftover socket --- weed/command/filer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weed/command/filer.go b/weed/command/filer.go index 989ed3bd0..2c91e6fec 100644 --- a/weed/command/filer.go +++ b/weed/command/filer.go @@ -269,9 +269,9 @@ func (fo *FilerOptions) startFiler() { if runtime.GOOS != "windows" { if *fo.localSocket == "" { *fo.localSocket = fmt.Sprintf("/tmp/seaweefs-filer-%d.sock", *fo.port) - if err := os.Remove(*fo.localSocket); err != nil && !os.IsNotExist(err) { - glog.Fatalf("Failed to remove %s, error: %s", *fo.localSocket, err.Error()) - } + } + if err := os.Remove(*fo.localSocket); err != nil && !os.IsNotExist(err) { + glog.Fatalf("Failed to remove %s, error: %s", *fo.localSocket, err.Error()) } go func() { // start on local unix socket