diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2013-06-30 23:53:49 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2013-06-30 23:53:49 +0200 |
commit | 4793221a53fb69aa519bc91ab19a79524c0df097 (patch) | |
tree | 81f64d8854f3918b4d2ac9825a9b8bd790b5454a /time.c | |
parent | 254b5a7a97e421a8d1cc6a70e3fbf8a33acccdbc (diff) | |
download | strace-4793221a53fb69aa519bc91ab19a79524c0df097.tar.gz strace-4793221a53fb69aa519bc91ab19a79524c0df097.tar.bz2 strace-4793221a53fb69aa519bc91ab19a79524c0df097.tar.xz |
Fold is_restart_error() into its sole user
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -256,15 +256,25 @@ sys_nanosleep(struct tcb *tcp) tprints(", "); } else { /* Second (returned) timespec is only significant - * if syscall was interrupted. We print only its address - * on _success_, since kernel doesn't modify its value. + * if syscall was interrupted. On success, we print + * only its address, since kernel doesn't modify it, + * and printing the value may show uninitialized data. */ - if (is_restart_error(tcp) || !tcp->u_arg[1]) - /* Interrupted (or NULL) */ + switch (tcp->u_error) { + default: + /* Not interrupted (slept entire interval) */ + if (tcp->u_arg[1]) { + tprintf("%#lx", tcp->u_arg[1]); + break; + } + /* Fall through: print_timespec(NULL) prints "NULL" */ + case ERESTARTSYS: + case ERESTARTNOINTR: + case ERESTARTNOHAND: + case ERESTART_RESTARTBLOCK: + /* Interrupted */ print_timespec(tcp, tcp->u_arg[1]); - else - /* Success */ - tprintf("%#lx", tcp->u_arg[1]); + } } return 0; } |