in drawterm/cpu.c, we have if(readstr(fd, buf, sizeof buf) < 0) fatal(1, "cannot read OK in p9any: got %d %s", n, buf); perhaps this is intended to be if((n = readstr(fd, buf, sizeof buf)) < 0) fatal(1, "cannot read OK in p9any: got %d %s", n, buf); but the latter is no help. readstr() returns 0 or -1, and if -1 the buf is not terminated by ‘\0’. therefore these should be simply if(readstr(fd, buf, sizeof buf) < 0) fatal(1, "cannot read OK in p9any”); by the way, how can I debug drawterm. fprint(2,…) is no effect. Kenji Arisawa
Unified · Split
| @@ -673,9 +673,9 @@ p9any(int fd) · 672 unmodified lines | ||
| 673 | 673 | fatal(1, "cannot write user/domain choice in p9any"); |
| 674 | 674 | if(v2){ |
| 675 | 675 | if(readstr(fd, buf, sizeof buf) < 0) |
| 676 | − fatal(1, "cannot read OK in p9any: got %d %s", n, buf); | |
| 676 | + fatal(1, "cannot read OK in p9any"); | |
| 677 | 677 | if(memcmp(buf, "OK\0", 3) != 0) |
| 678 | − fatal(1, "did not get OK in p9any"); | |
| 678 | + fatal(1, "did not get OK in p9any: got %s", buf); | |
| 679 | 679 | } |
| 680 | 680 | genrandom(crand, 2*NONCELEN); |
| 681 | 681 | genrandom(cchal, CHALLEN); |