ref: b55b1f31e139271852c3581924ddc92a10f54883
parent: b8ae7708fb3ef3acbb30ccf3181897f8157c18de
author: Ori Bernstein <[email protected]>
date: Sat Mar 25 15:15:14 EDT 2023
upas/runq: wait for bounce sender to exit (thanks grizi) when we send a return message, we need to wait for the message to exit before we clean up the state files.
--- a/sys/src/cmd/upas/q/runq.c
+++ b/sys/src/cmd/upas/q/runq.c
@@ -577,6 +577,7 @@
char buf[256], attachment[Pathlen], *sender;
int fd, pfd[2];
long n;
+ Waitmsg *wm;
String *s;
if(av[1] == 0 || av[2] == 0){
@@ -597,7 +598,7 @@
return -1;
}
- switch(rfork(RFFDG|RFPROC|RFENVG|RFNOWAIT)){
+ switch(rfork(RFFDG|RFPROC|RFENVG)){
case -1:
logit("runq - fork failed", w, name, av);
return -1;
@@ -633,6 +634,8 @@
break;
if(write(pfd[1], buf, n) != n){
close(fd);
+ wm = wait();
+ free(wm);
return -1;
}
}
@@ -639,6 +642,8 @@
close(fd);
}
close(pfd[1]);
+ wm = wait();
+ free(wm);
return 0;
}