From 1e1d44a4976ad2c1f4f8a6b8906054194f786de9 Mon Sep 17 00:00:00 2001 From: sperber Date: Fri, 7 Mar 2003 13:38:07 +0000 Subject: [PATCH] In FORK, flush output ports inside the narrowed section, not before, avoiding some, erm, pretty obvious race condition. --- scsh/scsh.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scsh/scsh.scm b/scsh/scsh.scm index 1a99eb3..393323d 100644 --- a/scsh/scsh.scm +++ b/scsh/scsh.scm @@ -1065,7 +1065,6 @@ ;;; Assumes niladic primitive %%FORK. (define (fork . stuff) - (flush-all-ports) (apply fork-1 #t stuff)) (define (%fork . stuff) @@ -1104,6 +1103,10 @@ (lambda (thunk) (thunk))))) (maybe-narrow (lambda () + + (if clear-interactive? + (flush-all-ports)) + ;; There was an atomicity problem/race condition -- if a child ;; process died after it was forked, but before the scsh fork ;; procedure could register the child's procobj in the