Fix duplicate file crash (#2)

This commit is contained in:
Auke Kok 2018-12-29 22:59:58 -08:00
parent 1de3af330f
commit 2d846f2e2e
2 changed files with 7 additions and 3 deletions

View File

@ -11,7 +11,7 @@ DIST := \
mtmediasrv.conf mtmediasrv.conf
PROJECT := mtmediasrv PROJECT := mtmediasrv
VERSION = 4 VERSION = 5
BUILD = `git describe --tags --always` BUILD = `git describe --tags --always`
$(PROJECT): main.go $(PROJECT): main.go

View File

@ -180,9 +180,13 @@ func collectMedia(l bool, c bool, e map[string]bool, w string) filepath.WalkFunc
if l { if l {
err := os.Link(path, of) err := os.Link(path, of)
if err != nil { if err != nil {
if err != os.ErrExist {
return err return err
} }
}
if err != os.ErrExist {
newmedia++ newmedia++
}
} else if c { } else if c {
in, err := os.Open(path) in, err := os.Open(path)
if err != nil { if err != nil {