Skip to content

Commit

Permalink
Refine fix to avoid passing timeout-usecs as #f.
Browse files Browse the repository at this point in the history
This is a more correct fix than that reverted in the (now reverted) commit
2014b87 ("Do not apply udev-monitor-set-timeout! to #f values") to correctly
handle the #:timeout-usecs keyword argument, which should not be specified
as #f per Guile's 'select' API.

* modules/udev/monitor.scm (make-udev-monitor): Avoid applying
udev-monitor-set-timeout! to a #f 3rd argument (usecs).
  • Loading branch information
Apteryks committed Dec 30, 2023
1 parent 3387958 commit ea2abcb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/udev/monitor.scm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ seconds and microseconds, respectively. If TIMEOUT-USEC, is used, TIMEOUT-SEC
must also have a value, else it is ignored, as for the 'secs' and 'usecs'
argument of Guile's 'select' procedure."
(let ((monitor (%make-udev-monitor udev)))
(udev-monitor-set-timeout! monitor timeout-sec timeout-usec)
;; Guile's select accepts #f for its optional 'secs' argument,
;; but not for usecs'.
(if timeout-usec
(udev-monitor-set-timeout! monitor timeout-sec timeout-usec)
(udev-monitor-set-timeout! monitor timeout-sec))
(udev-monitor-set-callback! monitor callback)
(udev-monitor-set-error-callback! monitor error-callback)
(when filter
Expand Down

0 comments on commit ea2abcb

Please sign in to comment.