> a better solution is to just use waitmsg (see wait(2)).  the parsing rules 
> and sizing are
> already implemented there.
yes, i agree. i changed my patch.

diff /n/dump/2016/0519/sys/src/libc/9sys/dial.c /sys/src/libc/9sys/dial.c
167c167
< notedeath(Dest *dp, char *exitsts)
---
> notedeath(Dest *dp, Waitmsg *exitsts)
169,170c169
<       int i, n, pid;
<       char *fields[5];                        /* pid + 3 times + error */
---
>       int n;
173,176c172
<       for (i = 0; i < nelem(fields); i++)
<               fields[i] = "";
<       n = tokenize(exitsts, fields, nelem(fields));
<       if (n < 4)
---
>       if (exitsts->pid <= 0)
178,180d173
<       pid = atoi(fields[0]);
<       if (pid <= 0)
<               return;
182c175
<               if (conn->pid == pid && !conn->dead) {  /* it's one we know? */
---
>               if (conn->pid == exitsts->pid && !conn->dead) {  /* it's one we 
> know? */
187,188c180,182
<                       strncpy(conn->err, fields[4], sizeof conn->err - 1);
<                       conn->err[sizeof conn->err - 1] = '\0';
---
>                       n = strlen(exitsts->msg);
>                       assert(n < ERRMAX);
>                       strncpy(conn->err, exitsts->msg, n);
209c203
<       char exitsts[2*ERRMAX];
---
>       Waitmsg *exitsts = nil;
211c205
<       if (outstandingprocs(dp) && await(exitsts, sizeof exitsts) >= 0) {
---
>       if (outstandingprocs(dp) && (exitsts = wait()) != nil) {


Reply via email to