From: Dmitry V. Levin Date: Mon, 19 Dec 2016 11:40:43 +0000 (+0000) Subject: Cleanup oldselect X-Git-Tag: v4.16~339 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4cb2d29f2f326b08eb8ce5f972f7ef1e13483aa0;p=strace Cleanup oldselect * desc.c (SYS_FUNC(oldselect)): Rewrite without use of macros. --- diff --git a/desc.c b/desc.c index 5badb144..4add78e7 100644 --- 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