SummaryRefsLogTreeCommitDiffStats
path: root/src/mcron
diff options
context:
space:
mode:
Diffstat (limited to 'src/mcron')
-rw-r--r--src/mcron/scripts/cron.scm7
-rw-r--r--src/mcron/scripts/mcron.scm12
-rw-r--r--src/mcron/utils.scm15
3 files changed, 11 insertions, 23 deletions
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 <dale_mellor@users.sourceforge.net>
-;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright © 2015, 2016, 2018 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of GNU Mcron.
;;;
@@ -18,6 +18,7 @@
;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>.
(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."))))
diff --git a/src/mcron/scripts/mcron.scm b/src/mcron/scripts/mcron.scm
index afb380f..6545ada 100644
--- a/src/mcron/scripts/mcron.scm
+++ b/src/mcron/scripts/mcron.scm
@@ -1,6 +1,6 @@
;;;; mcron -- run jobs at scheduled times
;;; Copyright © 2003, 2012 Dale Mellor <dale_mellor@users.sourceforge.net>
-;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright © 2015, 2016, 2018 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of GNU Mcron.
;;;
@@ -18,6 +18,7 @@
;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>.
(define-module (mcron scripts mcron)
+ #:use-module (ice-9 ftw)
#:use-module (mcron base)
#:use-module (mcron config)
#:use-module (mcron job-specifier) ;for user/system files
@@ -49,11 +50,10 @@ $XDG_CONFIG_HOME is not defined uses ~/.config/cron instead)."
(map (λ (dir)
(catch #t
(λ ()
- (for-each-file
- (λ (file)
- (process-user-file (string-append dir "/" file)
- #:input input-type))
- dir))
+ (for-each (λ (file)
+ (process-user-file (string-append dir "/" file)
+ #:input input-type))
+ (scandir dir)))
(λ (key . args)
(set! errors (1+ errors)))))
(list (string-append home-directory "/.cron")
diff --git a/src/mcron/utils.scm b/src/mcron/utils.scm
index 062e756..bb23f4a 100644
--- a/src/mcron/utils.scm
+++ b/src/mcron/utils.scm
@@ -1,6 +1,6 @@
;;;; utils.scm -- helper procedures
;;; Copyright © 2003, 2012 Dale Mellor <dale_mellor@users.sourceforge.net>
-;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright © 2015, 2016, 2018 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of GNU Mcron.
;;;
@@ -29,7 +29,6 @@
parse-args
show-version
show-package-information
- for-each-file
process-update-request)
#:re-export (option-ref
read-string))
@@ -81,18 +80,6 @@ General help using GNU software: <http://www.gnu.org/gethelp/>\n"
config-package-name
config-package-url))
-(define (for-each-file proc directory)
- "Apply PROC to each file in DIRECTORY. DIRECTORY must be a valid directory name.
-PROC must be a procedure that take one file name argument. The return value
-is not specified"
- (let ((dir (opendir directory)))
- (let loop ((file-name (readdir dir)))
- (if (eof-object? file-name)
- (closedir dir)
- (begin
- (proc file-name)
- (loop (readdir dir)))))))
-
(define (process-update-request fdes-list)
"Read a user name from the socket, dealing with the /etc/crontab special
case, remove all the user's jobs from the job list, and then re-read the