Skip to content

Commit

Permalink
Fix some rare IOServiceGetMatchingServices failure on MacOSX
Browse files Browse the repository at this point in the history
We had reports of users always getting:

  IOServiceGetMatchingServices failed, data changed while iterating

The issue seems related to the function getMatchingServices that
returns an always-invalid iterator even if there are no actual services.

This is a workaround for this issue.
  • Loading branch information
cmaglie committed Sep 14, 2023
1 parent 2e90307 commit f3f0122
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions enumerator/usb_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ func getAllServices(serviceType string) ([]io_object_t, error) {
services = append(services, service)
continue
}
// If iterator is still valid return the result
if i.IsValid() {
// If the list of services is empty or the iterator is still valid return the result
if len(services) == 0 || i.IsValid() {
return services, nil
}
// Otherwise empty the result and retry
Expand Down

0 comments on commit f3f0122

Please sign in to comment.