commit a42736003129d28186aa3c4ef74ed13a32297deb from: Omar Polo date: Sat Aug 07 20:47:35 2021 UTC implement .qid field for Rattach messages commit - c28153071384a25d2db06202d4b1435454654a1d commit + a42736003129d28186aa3c4ef74ed13a32297deb blob - 1d4314ab1041f15123d00ac0b3eb41bd90a2967a blob + 4d9762f94fc09a0e83c6154c96089f4803043cec --- script.c +++ script.c @@ -672,6 +672,7 @@ val_cast(struct value *a, int totype) int val_faccess(struct value *a, const char *field, struct value *ret) { + uint8_t mtype; #define MSGTYPE(m) *(m.msg + 4) /* skip the length */ @@ -690,6 +691,7 @@ val_faccess(struct value *a, const char *field, struct break; case V_MSG: + mtype = MSGTYPE(a->v.msg); if (!strcmp(field, "type")) { ret->type = V_U8; ret->v.u8 = MSGTYPE(a->v.msg); @@ -699,12 +701,15 @@ val_faccess(struct value *a, const char *field, struct memcpy(&ret->v.u16, &a->v.msg.msg[5], 2); ret->v.u16 = le16toh(ret->v.u16); return EVAL_OK; - } else if (!strcmp(field, "msize") && - MSGTYPE(a->v.msg) == Rversion) { + } else if (!strcmp(field, "msize") && mtype == Rversion) { ret->type = V_U32; memcpy(&ret->v.u32, &a->v.msg.msg[7], 4); ret->v.u32 = le32toh(ret->v.u32); return EVAL_OK; + } else if (!strcmp(field, "qid") && mtype == Rattach) { + ret->type = V_QID; + memcpy(&ret->v.qid, &a->v.msg.msg[7], QIDSIZE); + return EVAL_OK; } break;