cp/diff/mirror: Cleanup code and deprecate unnecessary flags. (#1914)
This fix also fixes an apparent crash found in diff.
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4bdc07]
goroutine 84 [running]:
panic(0x810ea0, 0xc4200120e0)
/home/builder/.gimme/versions/go1.7.3.linux.amd64/src/runtime/panic.go:500 +0x1a1
github.com/minio/mc/cmd.objectDifference.func1(0xc4200880a8, 0xc42042ee56, 0xc420315ec0, 0xc4200880b0, 0xc42042ee57, 0xc420315f20, 0xc42042ee54, 0xc42042ee55, 0xc420315501, 0xc4200880a0, ...)
/home/builder/mygo/src/github.com/minio/mc/cmd/difference.go:109 +0x197
created by github.com/minio/mc/cmd.objectDifference
/home/builder/mygo/src/github.com/minio/mc/cmd/difference.go:180 +0x2f5
```
This commit is contained in:
+3
-5
@@ -50,7 +50,7 @@ func (d differType) String() string {
|
||||
|
||||
// objectDifference function finds the difference between all objects
|
||||
// recursively in sorted order from source and target.
|
||||
func objectDifference(sourceClnt, targetClnt Client, sourceURL, targetURL string, watchMode bool) (diffCh chan diffMessage) {
|
||||
func objectDifference(sourceClnt, targetClnt Client, sourceURL, targetURL string) (diffCh chan diffMessage) {
|
||||
var (
|
||||
srcEOF, tgtEOF bool
|
||||
srcOk, tgtOk bool
|
||||
@@ -77,10 +77,8 @@ func objectDifference(sourceClnt, targetClnt Client, sourceURL, targetURL string
|
||||
|
||||
// No objects from source AND target: Finish
|
||||
if srcEOF && tgtEOF {
|
||||
if !watchMode {
|
||||
close(diffCh)
|
||||
break
|
||||
}
|
||||
close(diffCh)
|
||||
break
|
||||
}
|
||||
|
||||
if !srcEOF && srcCtnt.Err != nil {
|
||||
|
||||
Reference in New Issue
Block a user