Don't leak fd

This commit is contained in:
Jakob Borg 2014-08-23 10:37:58 +02:00
parent ebec4fbc24
commit e7f60161a3

View File

@ -39,15 +39,7 @@ type Staggered struct {
// Check if file or dir // Check if file or dir
func isFile(path string) bool { func isFile(path string) bool {
fileordir := path fileInfo, err := os.Stat(path)
file, err := os.Open(fileordir)
if err != nil {
l.Infoln("versioner isFile:", err)
return false
}
defer file.Close()
fileInfo, err := file.Stat()
if err != nil { if err != nil {
l.Infoln("versioner isFile:", err) l.Infoln("versioner isFile:", err)
return false return false