]> granicus.if.org Git - strace/commitdiff
mem.c: use runtime check in fetch_old_mmap_args
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 17 Jan 2018 02:29:17 +0000 (03:29 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 17 Jan 2018 04:34:49 +0000 (04:34 +0000)
This makes code a bit cleaner and makes it compatible with the upcoming
s390x compat support.

* mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): Replace
ANY_WORDSIZE_LESS_THAN_KERNEL_LONG check with current_wordsize == 4
check.

mem.c

diff --git a/mem.c b/mem.c
index 3a34fbb872072f0c413300779a1bc80fd96b7bef..6eb974dd4d3b151e23b26e922b0ceec818712bdf 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -117,17 +117,16 @@ fetch_old_mmap_args(struct tcb *tcp)
 {
        static kernel_ulong_t u_arg[6];
 
-# if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
-       /* We are here only in a 32-bit personality. */
-       unsigned int narrow_arg[6];
-       if (umove(tcp, tcp->u_arg[0], &narrow_arg))
-               return NULL;
-       for (unsigned int i = 0; i < 6; i++)
-               u_arg[i] = narrow_arg[i];
-# else
-       if (umove(tcp, tcp->u_arg[0], &u_arg))
-               return NULL;
-# endif
+       if (current_wordsize == 4) {
+               unsigned int narrow_arg[6];
+               if (umove(tcp, tcp->u_arg[0], &narrow_arg))
+                       return NULL;
+               for (unsigned int i = 0; i < 6; i++)
+                       u_arg[i] = narrow_arg[i];
+       } else {
+               if (umove(tcp, tcp->u_arg[0], &u_arg))
+                       return NULL;
+       }
 
        return u_arg;
 }