ref: 6ca0051718b6b953bf27a4a855ba1d5a22529768
parent: ac961e0f7ff10492fde119aecbc681b3cb9b9df9
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jan 20 07:02:03 EST 2019
rc: clear out redirections on "rfork F" (RFCFDG) rfork F closes all file descriptors, so we have to invalidate the redirections as they are now refering to closed files. not doing so causes the wrong file descriptors being closed later on as the fd numbers get reused.
--- a/sys/src/cmd/rc/plan9.c
+++ b/sys/src/cmd/rc/plan9.c
@@ -93,9 +93,14 @@
if(rfork(arg)==-1){pfmt(err, "rc: %s failed\n", runq->argv->words->word);
setstatus("rfork failed");- }
- else
+ } else {+ if(arg & RFCFDG){+ struct redir *rp;
+ for(rp = runq->redir; rp; rp = rp->next)
+ rp->type = 0;
+ }
setstatus("");+ }
poplist();
}
--
⑨