Skip to content

Commit bacddd7

Browse files
author
Leon Sodhi
committed
Merge pull request #17 from papertrail/13-no-blank-pid-files
No blank pid files
2 parents 39552e6 + b649bf7 commit bacddd7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

config_manager.go

+7
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,14 @@ func (cm *ConfigManager) defaultPidFile() string {
309309
if err != nil {
310310
continue
311311
}
312+
tmpPidFile := fd.Name()
312313
fd.Close()
314+
err = os.Remove(tmpPidFile)
315+
if err != nil {
316+
// Die because the lockfile lib can't handle an existing blank file
317+
log.Criticalf("Can't remove temp pid file. Details: %s", err.Error())
318+
os.Exit(1)
319+
}
313320
return f
314321
}
315322
return "/tmp/remote_syslog.pid"

0 commit comments

Comments
 (0)