From f908c5395c24da621e5e30814a7a3e4fb76abcbc Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Tue, 20 Mar 2018 14:44:54 +0100 Subject: utils: Use 'scandir' instead of custom 'for-each-file' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/mcron/utils.scm (for-each-file): Delete. * src/mcron/scripts/cron.scm (process-files-in-system-directory): Use 'scandir' which has the benefit of being deterministic. * src/mcron/scripts/mcron.scm (process-files-in-user-directory): Likewise. * tests/schedule.sh: Update expected output which is now more reliable. * NEWS: Update. Suggested-by: Ludovic Courtès --- src/mcron/scripts/cron.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mcron/scripts/cron.scm') diff --git a/src/mcron/scripts/cron.scm b/src/mcron/scripts/cron.scm index 5052c32..323499e 100644 --- a/src/mcron/scripts/cron.scm +++ b/src/mcron/scripts/cron.scm @@ -1,6 +1,6 @@ ;;;; cron -- daemon for running jobs at scheduled times ;;; Copyright © 2003, 2012 Dale Mellor -;;; Copyright © 2015, 2016 Mathieu Lirzin +;;; Copyright © 2015, 2016, 2018 Mathieu Lirzin ;;; ;;; This file is part of GNU Mcron. ;;; @@ -18,6 +18,7 @@ ;;; along with GNU Mcron. If not, see . (define-module (mcron scripts cron) + #:use-module (ice-9 ftw) #:use-module (mcron base) #:use-module (mcron config) #:use-module (mcron job-specifier) @@ -84,13 +85,13 @@ operation. The permissions on the /var/cron/tabs directory enforce this." (catch #t (λ () - (for-each-file + (for-each (λ (user) (and-let* ((entry (user-entry user))) ;crontab without user? (set-configuration-user entry) (catch-mcron-error (read-vixie-file (string-append config-spool-dir "/" user))))) - config-spool-dir)) + (scandir config-spool-dir))) (λ (key . args) (mcron-error 4 "You do not have permission to access the system crontabs.")))) -- cgit v1.2.3