Revert "Minor cosmetic simplification of case logic after previous patch."

This reverts commit 99a26e5de6.
This commit is contained in:
Dale Mellor 2022-01-01 06:47:04 +00:00
commit 9e99490925

View file

@ -176,31 +176,31 @@ unusable."
"Run JOB in a separate process. The process is run as JOB user with the "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 environment properly set. Update the NEXT-TIME field of JOB by computing its
next value." next value."
(case (primitive-fork) (if (= (primitive-fork) 0)
((0) (dynamic-wind ;child (dynamic-wind ;child
(const #t) (const #t)
(λ () (λ ()
(setgid (passwd:gid (job:user job))) (setgid (passwd:gid (job:user job)))
(setuid (passwd:uid (job:user job))) (setuid (passwd:uid (job:user job)))
;; Handle the case where the home directory points to a nonexistent
;; Handle the case where the home directory points to a ;; location, as can be the case when running the job as the "nobody"
;; nonexistent location, as can be the case when running ;; user.
;; the job as the "nobody" user. (catch 'system-error
(catch 'system-error (lambda ()
(λ () (chdir (passwd:dir (job:user job))))
(chdir (passwd:dir (job:user job)))) (lambda args
(λ args (let ((errno (system-error-errno args)))
(if (= ENOENT (system-error-errno args)) (cond
(chdir "/") ((= ENOENT errno) (chdir "/"))
(throw 'system-error args)))) (else (throw 'system-error args))))))
(modify-environment (job:environment job) (job:user job))
(modify-environment (job:environment job) (job:user job)) ((job:action job)))
((job:action job))) (λ ()
(λ () (primitive-exit 0)))
(primitive-exit 0)))) (begin ;parent
(else (update-number-children! 1+) ;parent (update-number-children! 1+)
(job:next-time-set! job ((job:next-time-function job) (job:next-time-set! job ((job:next-time-function job)
(current-time)))))) (current-time))))))
(define (child-cleanup) (define (child-cleanup)
;; Give any zombie children a chance to die, and decrease the number known ;; Give any zombie children a chance to die, and decrease the number known