fileutil: return on error and send it to error chan

release-2.1
Xiang Li 2015-06-10 15:59:24 -07:00
parent e2c2f098bc
commit dc87454487
1 changed files with 4 additions and 0 deletions

View File

@ -57,10 +57,14 @@ func PurgeFile(dirname string, suffix string, max uint, interval time.Duration,
err = l.Unlock()
if err != nil {
plog.Errorf("error unlocking %s when purging file (%v)", l.Name(), err)
errC <- err
return
}
err = l.Destroy()
if err != nil {
plog.Errorf("error destroying lock %s when purging file (%v)", l.Name(), err)
errC <- err
return
}
plog.Infof("purged file %s successfully", f)
newfnames = newfnames[1:]