]> granicus.if.org Git - strace/commitdiff
Cleanup oldselect
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 19 Dec 2016 11:40:43 +0000 (11:40 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 19 Dec 2016 11:40:43 +0000 (11:40 +0000)
* desc.c (SYS_FUNC(oldselect)): Rewrite without use of macros.

desc.c

diff --git a/desc.c b/desc.c
index 5badb144fe50fb2797f48d69e6bd8c5241a2917f..4add78e734d0ef9125fbbb6abb67883f0d7e3375 100644 (file)
--- a/desc.c
+++ b/desc.c
@@ -192,26 +192,26 @@ decode_select(struct tcb *tcp, long *args,
 
 SYS_FUNC(oldselect)
 {
-       long long_args[5];
-#undef oldselect_args
-#if SIZEOF_LONG == 4
-# define oldselect_args long_args
-#else
+       long select_args[5];
        unsigned int oldselect_args[5];
-       unsigned int i;
-#endif
 
-       if (umove(tcp, tcp->u_arg[0], &oldselect_args) < 0) {
-               printaddr(tcp->u_arg[0]);
-               return 0;
-       }
-#ifndef oldselect_args
-       for (i = 0; i < 5; i++) {
-               long_args[i] = oldselect_args[i];
+       if (sizeof(*select_args) == sizeof(*oldselect_args)) {
+               if (umove_or_printaddr(tcp, tcp->u_arg[0], &select_args)) {
+                       return 0;
+               }
+       } else {
+               unsigned int i;
+
+               if (umove_or_printaddr(tcp, tcp->u_arg[0], &oldselect_args)) {
+                       return 0;
+               }
+
+               for (i = 0; i < 5; ++i) {
+                       select_args[i] = oldselect_args[i];
+               }
        }
-#endif
-       return decode_select(tcp, long_args, print_timeval, sprint_timeval);
-#undef oldselect_args
+
+       return decode_select(tcp, select_args, print_timeval, sprint_timeval);
 }
 
 #ifdef ALPHA