commit f55ab68b8ccd0c8d7fe509f6949f6e65bf77c93b from: Omar Polo date: Wed Jan 19 21:37:06 2022 UTC 9pclib: send size in wstat This is the counterpart for the recent kamid commit about wstat: we're lacking the leading size field. commit - 9029ac6f3c1fa3e42c6fa231f8a45ed05d68b61e commit + f55ab68b8ccd0c8d7fe509f6949f6e65bf77c93b blob - d53ac475b40fa93e409221ea11b457252ba56a35 blob + 9394060b085ba279ba8f71506678bfb00c437df6 --- lib/9pclib.c +++ lib/9pclib.c @@ -251,20 +251,25 @@ void twstat(uint32_t fid, const struct np_stat *st) { uint32_t len; + uint16_t stlen; /* fid[4] stat[n] */ - len = sizeof(fid) + NPSTATSIZ(0, 0, 0, 0); + + stlen = NPSTATSIZ(0, 0, 0, 0); if (st->name != NULL) - len += strlen(st->name); + stlen += strlen(st->name); if (st->uid != NULL) - len += strlen(st->uid); - if (st->gid != NULL) - len += strlen(st->gid); + stlen += strlen(st->uid); + if (st->gid != NULL) + stlen += strlen(st->gid); if (st->muid != NULL) - len += strlen(st->muid); + stlen += strlen(st->muid); + len = sizeof(fid) + sizeof(stlen) + stlen; + write_hdr_auto(len, Twstat); write_fid(fid); + write_16(stlen); write_16(st->type); write_32(st->dev);