]> granicus.if.org Git - strace/commitdiff
Fix decoding of times syscall return value
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 20 Aug 2015 21:20:14 +0000 (21:20 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 20 Aug 2015 21:37:41 +0000 (21:37 +0000)
Always print return value of successful times syscall
as unsigned long integer.

* times.c (sys_times): Return RVAL_UDECIMAL unless syserror.

times.c

diff --git a/times.c b/times.c
index 0301c9f9520c362fa2b078418e32bd32bfb1ac45..64729cfa30942bf81b6a11e93218a1a581c33885 100644 (file)
--- a/times.c
+++ b/times.c
@@ -5,15 +5,17 @@ SYS_FUNC(times)
 {
        struct tms tbuf;
 
-       if (exiting(tcp)) {
-               if (!umove_or_printaddr(tcp, tcp->u_arg[0], &tbuf)) {
-                       tprintf("{tms_utime=%llu, tms_stime=%llu, ",
-                               (unsigned long long) tbuf.tms_utime,
-                               (unsigned long long) tbuf.tms_stime);
-                       tprintf("tms_cutime=%llu, tms_cstime=%llu}",
-                               (unsigned long long) tbuf.tms_cutime,
-                               (unsigned long long) tbuf.tms_cstime);
-               }
+       if (entering(tcp))
+               return 0;
+
+       if (!umove_or_printaddr(tcp, tcp->u_arg[0], &tbuf)) {
+               tprintf("{tms_utime=%llu, tms_stime=%llu, ",
+                       (unsigned long long) tbuf.tms_utime,
+                       (unsigned long long) tbuf.tms_stime);
+               tprintf("tms_cutime=%llu, tms_cstime=%llu}",
+                       (unsigned long long) tbuf.tms_cutime,
+                       (unsigned long long) tbuf.tms_cstime);
        }
-       return 0;
+
+       return syserror(tcp) ? RVAL_DECIMAL : RVAL_UDECIMAL;
 }