mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 12:26:34 +02:00
Only attempt rotation if files already exist when a Write is requested. (#18262)
This commit is contained in:
parent
075fdbae95
commit
f80e788129
@ -48,14 +48,13 @@ type LogFile struct {
|
||||
func (l *LogFile) Write(b []byte) (n int, err error) {
|
||||
l.acquire.Lock()
|
||||
defer l.acquire.Unlock()
|
||||
|
||||
// Create a new file if we have no file to write to
|
||||
if l.fileInfo == nil {
|
||||
if err := l.openNew(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
// Check for the last contact and rotate if necessary
|
||||
if err := l.rotate(); err != nil {
|
||||
} else if err := l.rotate(); err != nil { // Check for the last contact and rotate if necessary
|
||||
return 0, err
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user