]> granicus.if.org Git - strace/commitdiff
Revert last change. Add a comment to prevent further misunderstanding
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 28 Jan 2012 01:29:36 +0000 (02:29 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 28 Jan 2012 01:29:36 +0000 (02:29 +0100)
* time.c (sys_nanosleep): Display remaining time only on interrupt.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
time.c

diff --git a/time.c b/time.c
index 497be75f785908bfe4ab31907d6496007ccb87a8..0c938f8ffff8f754384aa65b5b6bb41457ec75a0 100644 (file)
--- a/time.c
+++ b/time.c
@@ -271,9 +271,15 @@ sys_nanosleep(struct tcb *tcp)
                print_timespec(tcp, tcp->u_arg[0]);
                tprints(", ");
        } else {
-               if (!tcp->u_arg[1] || !is_restart_error(tcp))
+               /* 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 (is_restart_error(tcp) || !tcp->u_arg[1])
+                       /* Interrupted (or NULL) */
                        print_timespec(tcp, tcp->u_arg[1]);
                else
+                       /* Success */
                        tprintf("%#lx", tcp->u_arg[1]);
        }
        return 0;