Skip to content

Commit

Permalink
Fix the logic used for retrying reads after EINVAL
Browse files Browse the repository at this point in the history
The previous way of testing for EINVAL here would have retried
indefinitely for as long as EINVAL was returned, instead of giving up
after five tries (as was obviously the intent). This commit makes it
retry only if tries is less than 5, rather than if tries is equal to 5.
  • Loading branch information
Steven McDonald committed Sep 22, 2014
1 parent 1417184 commit f5598f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rb-inotify/notifier.rb
Expand Up @@ -269,7 +269,7 @@ def read_events
rescue SystemCallError => er
# EINVAL means that there's more data to be read
# than will fit in the buffer size
raise er unless er.errno == Errno::EINVAL::Errno || tries == 5
raise er unless er.errno == Errno::EINVAL::Errno && tries < 5
size *= 2
tries += 1
retry
Expand Down

0 comments on commit f5598f7

Please sign in to comment.