ref: 116b075371ec9a8af831e142f194a7a4a2fa738a
parent: 83aa7ba70933335cd579b560a793b7741d5e3931
author: cinap_lenrek <[email protected]>
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();
}