From: Dmitry V. Levin Date: Mon, 26 Dec 2016 20:21:23 +0000 (+0000) Subject: Simplify personality checks in msghdr.c and signal.c X-Git-Tag: v4.16~139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=835fb3c5f27374db0dcfadd66f5adec88bc05d2b;p=strace Simplify personality checks in msghdr.c and signal.c * msghdr.c: Check for [!current_wordsize] instead of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]. * signal.c: Likewise. --- diff --git a/msghdr.c b/msghdr.c index f9264a60..56ba5498 100644 --- a/msghdr.c +++ b/msghdr.c @@ -39,7 +39,7 @@ #include "xlat/scmvals.h" #include "xlat/ip_cmsg_types.h" -#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 +#ifndef current_wordsize struct cmsghdr32 { uint32_t cmsg_len; int cmsg_level; @@ -50,7 +50,7 @@ struct cmsghdr32 { typedef union { char *ptr; struct cmsghdr *cmsg; -#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 +#ifndef current_wordsize struct cmsghdr32 *cmsg32; #endif } union_cmsghdr; @@ -260,7 +260,7 @@ decode_msg_control(struct tcb *const tcp, const kernel_ulong_t addr, tprints(", msg_control="); const unsigned int cmsg_size = -#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 +#ifndef current_wordsize (current_wordsize < sizeof(long)) ? sizeof(struct cmsghdr32) : #endif sizeof(struct cmsghdr); @@ -280,17 +280,17 @@ decode_msg_control(struct tcb *const tcp, const kernel_ulong_t addr, tprints("["); while (buf_len >= cmsg_size) { const kernel_ulong_t cmsg_len = -#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 +#ifndef current_wordsize (current_wordsize < sizeof(long)) ? u.cmsg32->cmsg_len : #endif u.cmsg->cmsg_len; const int cmsg_level = -#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 +#ifndef current_wordsize (current_wordsize < sizeof(long)) ? u.cmsg32->cmsg_level : #endif u.cmsg->cmsg_level; const int cmsg_type = -#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 +#ifndef current_wordsize (current_wordsize < sizeof(long)) ? u.cmsg32->cmsg_type : #endif u.cmsg->cmsg_type; diff --git a/signal.c b/signal.c index 30838b23..ef7bed88 100644 --- a/signal.c +++ b/signal.c @@ -310,8 +310,8 @@ decode_old_sigaction(struct tcb *const tcp, const kernel_ulong_t addr) { struct old_sigaction sa; -#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 - if (current_wordsize != sizeof(sa.sa_handler__) && current_wordsize == 4) { +#ifndef current_wordsize + if (current_wordsize < sizeof(sa.sa_handler__)) { struct old_sigaction32 sa32; if (umove_or_printaddr(tcp, addr, &sa32)) @@ -501,8 +501,8 @@ decode_new_sigaction(struct tcb *const tcp, const kernel_ulong_t addr) { struct new_sigaction sa; -#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 - if (current_wordsize != sizeof(sa.sa_flags) && current_wordsize == 4) { +#ifndef current_wordsize + if (current_wordsize < sizeof(sa.sa_handler__)) { struct new_sigaction32 sa32; if (umove_or_printaddr(tcp, addr, &sa32))