aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-04-05 00:04:00 -0700
committerChris Lu <chris.lu@gmail.com>2019-04-05 00:04:00 -0700
commit921231268b182620aa004fb49c7e318225b0b3bd (patch)
treed4a72ac115c879760687a9efd8c5724e4ba3ec40
parent4f714cef22cc738d550a338c8009a76db8d55cfc (diff)
downloadseaweedfs-921231268b182620aa004fb49c7e318225b0b3bd.tar.xz
seaweedfs-921231268b182620aa004fb49c7e318225b0b3bd.zip
weed filer.copy: skip files that can not be opened
such as socket
-rw-r--r--weed/command/filer_copy.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go
index 6750617db..bd4c7d166 100644
--- a/weed/command/filer_copy.go
+++ b/weed/command/filer_copy.go
@@ -1,25 +1,24 @@
package command
import (
+ "context"
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/operation"
+ "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/security"
"github.com/chrislusf/seaweedfs/weed/server"
+ "github.com/chrislusf/seaweedfs/weed/util"
"github.com/chrislusf/seaweedfs/weed/wdclient"
"github.com/spf13/viper"
"google.golang.org/grpc"
+ "io"
"io/ioutil"
+ "net/http"
"net/url"
"os"
"path/filepath"
- "strings"
-
- "context"
- "github.com/chrislusf/seaweedfs/weed/operation"
- "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
- "github.com/chrislusf/seaweedfs/weed/util"
- "io"
- "net/http"
"strconv"
+ "strings"
"time"
)
@@ -123,6 +122,10 @@ func doEachCopy(ctx context.Context, fileOrDir string, filerAddress, filerGrpcAd
f, err := os.Open(fileOrDir)
if err != nil {
fmt.Printf("Failed to open file %s: %v\n", fileOrDir, err)
+ if _, ok := err.(*os.PathError); ok {
+ fmt.Printf("skipping %s\n", fileOrDir)
+ return true
+ }
return false
}
defer f.Close()