Browse Source

fileutil: return on error and send it to error chan

Xiang Li 10 years ago
parent
commit
dc87454487
1 changed files with 4 additions and 0 deletions
  1. 4 0
      pkg/fileutil/purge.go

+ 4 - 0
pkg/fileutil/purge.go

@@ -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:]