AboutSummaryRefsLogTreeCommitDiffStats
path: root/src/mcron/base.scm
diff options
context:
space:
mode:
authorDale Mellor <mcron-lsfnyl@rdmp.org>2021-12-30 03:53:02 +0000
committerDale Mellor <mcron-lsfnyl@rdmp.org>2021-12-30 04:00:28 +0000
commit99a26e5de6d132056999074ce4f4f2cf24ec8c2f (patch)
tree8ced7e59dd87f5347bffb7f6a8df8ce97bd783e6 /src/mcron/base.scm
parent8b27157f579611666019c3ed517d3f6bc265f394 (diff)
downloadmcron-99a26e5de6d132056999074ce4f4f2cf24ec8c2f.tar.gz
mcron-99a26e5de6d132056999074ce4f4f2cf24ec8c2f.tar.bz2
mcron-99a26e5de6d132056999074ce4f4f2cf24ec8c2f.zip
Minor cosmetic simplification of case logic after previous patch.
* src/mcron/base.scm: change around some /cond/s and /if/s.
Diffstat (limited to 'src/mcron/base.scm')
-rw-r--r--src/mcron/base.scm50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/mcron/base.scm b/src/mcron/base.scm
index 037a9b7..c0404ae 100644
--- a/src/mcron/base.scm
+++ b/src/mcron/base.scm
@@ -176,31 +176,31 @@ unusable."
"Run JOB in a separate process. The process is run as JOB user with the
environment properly set. Update the NEXT-TIME field of JOB by computing its
next value."
- (if (= (primitive-fork) 0)
- (dynamic-wind ;child
- (const #t)
- (λ ()
- (setgid (passwd:gid (job:user job)))
- (setuid (passwd:uid (job:user job)))
- ;; Handle the case where the home directory points to a nonexistent
- ;; location, as can be the case when running the job as the "nobody"
- ;; user.
- (catch 'system-error
- (lambda ()
- (chdir (passwd:dir (job:user job))))
- (lambda args
- (let ((errno (system-error-errno args)))
- (cond
- ((= ENOENT errno) (chdir "/"))
- (else (throw 'system-error args))))))
- (modify-environment (job:environment job) (job:user job))
- ((job:action job)))
- (λ ()
- (primitive-exit 0)))
- (begin ;parent
- (update-number-children! 1+)
- (job:next-time-set! job ((job:next-time-function job)
- (current-time))))))
+ (case (primitive-fork)
+ ((0) (dynamic-wind ;child
+ (const #t)
+ (λ ()
+ (setgid (passwd:gid (job:user job)))
+ (setuid (passwd:uid (job:user job)))
+
+ ;; Handle the case where the home directory points to a
+ ;; nonexistent location, as can be the case when running
+ ;; the job as the "nobody" user.
+ (catch 'system-error
+ (λ ()
+ (chdir (passwd:dir (job:user job))))
+ (λ args
+ (if (= ENOENT (system-error-errno args))
+ (chdir "/")
+ (throw 'system-error args))))
+
+ (modify-environment (job:environment job) (job:user job))
+ ((job:action job)))
+ (λ ()
+ (primitive-exit 0))))
+ (else (update-number-children! 1+) ;parent
+ (job:next-time-set! job ((job:next-time-function job)
+ (current-time))))))
(define (child-cleanup)
;; Give any zombie children a chance to die, and decrease the number known