From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <79e6d7db8a4621d9a1305b0499c54a72@9netics.com> To: 9fans@9fans.net Date: Sat, 21 May 2016 14:45:04 -0700 From: Skip Tavakkolian <9nut@9netics.com> In-Reply-To: <36c146b2e870849515a1677237037219@lilly.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] bug in authdial() Topicbox-Message-UUID: 92bb172c-ead9-11e9-9d60-3106f5b1d025 > 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) {