Skip to content

Commit

Permalink
errors.is() - windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Oct 28, 2024
1 parent 19dd5b8 commit 22033ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/acquisition/modules/wineventlog/wineventlog_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (w *WinEventLogSource) getXMLEvents(config *winlog.SubscribeConfig, publish
2000, // Timeout in milliseconds to wait.
0, // Reserved. Must be zero.
&returned) // The number of handles in the array that are set by the API.
if err == windows.ERROR_NO_MORE_ITEMS {
if errors.Is(err, windows.ERROR_NO_MORE_ITEMS) {
return nil, err
} else if err != nil {
return nil, fmt.Errorf("wevtapi.EvtNext failed: %v", err)
Expand Down Expand Up @@ -188,7 +188,7 @@ func (w *WinEventLogSource) getEvents(out chan types.Event, t *tomb.Tomb) error
}
if status == syscall.WAIT_OBJECT_0 {
renderedEvents, err := w.getXMLEvents(w.evtConfig, publisherCache, subscription, 500)
if err == windows.ERROR_NO_MORE_ITEMS {
if errors.Is(err, windows.ERROR_NO_MORE_ITEMS) {
windows.ResetEvent(w.evtConfig.SignalEvent)
} else if err != nil {
w.logger.Errorf("getXMLEvents failed: %v", err)
Expand Down Expand Up @@ -413,7 +413,7 @@ OUTER_LOOP:
return nil
default:
evts, err := w.getXMLEvents(w.evtConfig, publisherCache, handle, 500)
if err == windows.ERROR_NO_MORE_ITEMS {
if errors.Is(err, windows.ERROR_NO_MORE_ITEMS) {
log.Info("No more items")
break OUTER_LOOP
} else if err != nil {
Expand Down

0 comments on commit 22033ec

Please sign in to comment.