Skip to content

Commit

Permalink
file-scanner: prevent deadlock; seek to end of log file when opening …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
tgmpje committed Sep 19, 2023
1 parent 04c5620 commit 389dd97
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scanners/file/file-scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,14 @@ func TailFile(filename string, useNotify bool) error {
if err != nil {
return err
}
if _, err := file.Seek(0, os.SEEK_END); err != nil {
return err
}

f := &File{
Name: filename,
OriginalName: filename,
Stop: make(chan struct{}),
Stop: make(chan struct{}, 1),
file: file,
useNotify: useNotify,
}
Expand Down

0 comments on commit 389dd97

Please sign in to comment.