From: Dmitry V. Levin Date: Tue, 28 Jun 2016 22:25:10 +0000 (+0000) Subject: msghdr.c: fix representation of integer struct cmsghdr.cmsg_data values X-Git-Tag: v4.13~85 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17e624cf96103b0c91ec3c7731d27cebacc255e3;p=strace msghdr.c: fix representation of integer struct cmsghdr.cmsg_data values * msghdr.c (print_cmsg_ip_ttl, print_cmsg_ip_tos, print_cmsg_ip_checksum): Print struct cmsghdr.cmsg_data value as an array element. * tests/inet-cmsg.c (print_ttl, print_tos): Update expected output. --- diff --git a/msghdr.c b/msghdr.c index 66e5a704..bad3357e 100644 --- a/msghdr.c +++ b/msghdr.c @@ -124,7 +124,7 @@ print_cmsg_ip_ttl(struct tcb *tcp, const void *cmsg_data, if (sizeof(*ttl) > data_len) return; - tprintf(", cmsg_data={ttl=%u}", *ttl); + tprintf(", cmsg_data=[%u]", *ttl); } static void @@ -136,7 +136,7 @@ print_cmsg_ip_tos(struct tcb *tcp, const void *cmsg_data, if (sizeof(*tos) > data_len) return; - tprintf(", cmsg_data={tos=%x}", *tos); + tprintf(", cmsg_data=[%#x]", *tos); } static void @@ -148,7 +148,7 @@ print_cmsg_ip_checksum(struct tcb *tcp, const void *cmsg_data, if (sizeof(*csum) > data_len) return; - tprintf(", cmsg_data={csum=%u}", *csum); + tprintf(", cmsg_data=[%u]", *csum); } static void diff --git a/tests/inet-cmsg.c b/tests/inet-cmsg.c index b1d655a2..5b020417 100644 --- a/tests/inet-cmsg.c +++ b/tests/inet-cmsg.c @@ -48,7 +48,7 @@ print_ttl(const struct cmsghdr *c) { const unsigned int *ttl = (const unsigned int *) CMSG_DATA(c); - printf("IP_TTL, cmsg_data={ttl=%u}", *ttl); + printf("IP_TTL, cmsg_data=[%u]", *ttl); } static void @@ -56,7 +56,7 @@ print_tos(const struct cmsghdr *c) { const uint8_t *tos = (const uint8_t *) CMSG_DATA(c); - printf("IP_TOS, cmsg_data={tos=%x}", *tos); + printf("IP_TOS, cmsg_data=[%#x]", *tos); } static void