From 33879583ae9a18994eed50b910af28ccf8804776 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Thu, 28 Dec 2023 20:23:16 -0500 Subject: [PATCH 1/2] Revert "Do not apply udev-monitor-set-timeout! to #f values." This reverts commit 2014b87c7585650596ddc27f893657e38c7f2472. A better correction will follow. --- modules/udev/monitor.scm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/udev/monitor.scm b/modules/udev/monitor.scm index e3599e8..a97a7de 100644 --- a/modules/udev/monitor.scm +++ b/modules/udev/monitor.scm @@ -27,7 +27,6 @@ ;;; Code: (define-module (udev monitor) - #:use-module (srfi srfi-1) #:export (udev-monitor udev-monitor? %make-udev-monitor @@ -64,9 +63,7 @@ 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))) - (apply udev-monitor-set-timeout! - (cons monitor - (filter-map identity (list timeout-sec timeout-usec)))) + (udev-monitor-set-timeout! monitor timeout-sec timeout-usec) (udev-monitor-set-callback! monitor callback) (udev-monitor-set-error-callback! monitor error-callback) (when filter From ea2abcb78f494de58f906b328ceacec8f681cccc Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Thu, 28 Dec 2023 20:32:29 -0500 Subject: [PATCH 2/2] Refine fix to avoid passing timeout-usecs as #f. 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). --- modules/udev/monitor.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/udev/monitor.scm b/modules/udev/monitor.scm index a97a7de..6f8acb2 100644 --- a/modules/udev/monitor.scm +++ b/modules/udev/monitor.scm @@ -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