mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-01 00:23:48 +03:00
tls: Ensure parent dir exists before creating lock file
This commit is contained in:
parent
4b2e22289d
commit
ef585ed810
1 changed files with 4 additions and 0 deletions
|
@ -61,6 +61,10 @@ func (s *fileStorageLock) TryLock(name string) (Waiter, error) {
|
|||
filename: s.storage.siteCertFile(name) + ".lock",
|
||||
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)
|
||||
if err != nil {
|
||||
if os.IsExist(err) {
|
||||
|
|
Loading…
Reference in a new issue