Commit ef585ed8 authored by Matthew Holt's avatar Matthew Holt

tls: Ensure parent dir exists before creating lock file

parent 4b2e2228
...@@ -61,6 +61,10 @@ func (s *fileStorageLock) TryLock(name string) (Waiter, error) { ...@@ -61,6 +61,10 @@ func (s *fileStorageLock) TryLock(name string) (Waiter, error) {
filename: s.storage.siteCertFile(name) + ".lock", filename: s.storage.siteCertFile(name) + ".lock",
wg: new(sync.WaitGroup), wg: new(sync.WaitGroup),
} }
// parent dir must exist
if err := os.MkdirAll(s.storage.site(name), 0700); err != nil {
return nil, err
}
lf, err := os.OpenFile(fw.filename, os.O_CREATE|os.O_EXCL, 0644) lf, err := os.OpenFile(fw.filename, os.O_CREATE|os.O_EXCL, 0644)
if err != nil { if err != nil {
if os.IsExist(err) { if os.IsExist(err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment