msghdr.c: fix representation of struct cmsghdr.cmsg_data integer arrays
* msghdr.c (print_cmsg_ip_opts): Print struct cmsghdr.cmsg_data as an array of hexadecimal integers. * tests/inet-cmsg.c (print_opts): Update expected output.
This commit is contained in:
parent
17e624cf96
commit
2a897372db
11
msghdr.c
11
msghdr.c
@ -161,10 +161,13 @@ print_cmsg_ip_opts(struct tcb *tcp, const void *cmsg_data,
|
||||
if (!data_len)
|
||||
return;
|
||||
|
||||
tprints(", cmsg_data={opts=0x");
|
||||
for (i = 0; i < data_len; ++i)
|
||||
tprintf("%02x", opts[i]);
|
||||
tprints("}");
|
||||
tprints(", cmsg_data=[");
|
||||
for (i = 0; i < data_len; ++i) {
|
||||
if (i)
|
||||
tprints(", ");
|
||||
tprintf("0x%02x", opts[i]);
|
||||
}
|
||||
tprints("]");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -67,11 +67,11 @@ print_opts(const char *name, const struct cmsghdr *c)
|
||||
|
||||
printf("%s", name);
|
||||
if (len) {
|
||||
printf(", cmsg_data={opts=0x");
|
||||
printf(", cmsg_data=[");
|
||||
size_t i;
|
||||
for (i = 0; i < len; ++i)
|
||||
printf("%02x", opts[i]);
|
||||
printf("}");
|
||||
printf("%s0x%02x", i ? ", " : "", opts[i]);
|
||||
printf("]");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user