audit/file: Attempt to create directory path. Fixes #38
This commit is contained in:
parent
1a5b774527
commit
27c73da308
|
@ -3,6 +3,7 @@ package file
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/hashicorp/vault/audit"
|
||||
|
@ -56,6 +57,9 @@ func (b *Backend) open() error {
|
|||
if b.f != nil {
|
||||
return nil
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Dir(b.Path), 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var err error
|
||||
b.f, err = os.OpenFile(b.Path, os.O_APPEND|os.O_WRONLY, 0600)
|
||||
|
|
Loading…
Reference in a new issue