This commit is contained in:
d3m0k1d
2026-01-11 19:41:04 +03:00
parent 424f5db9af
commit 95ce6441d1
7 changed files with 58 additions and 19 deletions

View File

@@ -22,7 +22,7 @@ type Scanner struct {
}
func NewScanner(path string) (*Scanner, error) {
file, err := os.Open(path)
file, err := os.Open(path) // #nosec G304 -- admin tool, runs as root, path controlled by operator
if err != nil {
return nil, err
}
@@ -67,7 +67,10 @@ func (s *Scanner) Start() {
func (s *Scanner) Stop() {
close(s.stopCh)
time.Sleep(150 * time.Millisecond)
s.file.Close()
err := s.file.Close()
if err != nil {
s.logger.Error("Failed to close file")
}
close(s.ch)
}