]> granicus.if.org Git - strace/blobdiff - uid.c
print_array: enhance printing of unfetchable object addresses
[strace] / uid.c
diff --git a/uid.c b/uid.c
index d45637d84ca5da8984312671ef00ead3f594b421..c56bf17993a2155abab6b68f7d9b624ebea337fe 100644 (file)
--- a/uid.c
+++ b/uid.c
@@ -4,6 +4,7 @@
  * Copyright (c) 1993-1996 Rick Sladkey <jrs@world.std.com>
  * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
  * Copyright (c) 2003-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2014-2018 The strace developers.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,9 +35,9 @@
 #  error invalid STRACE_UID_SIZE
 # endif
 
-# define SIZEIFY(x)            SIZEIFY_(x,STRACE_UID_SIZE)
-# define SIZEIFY_(x,size)      SIZEIFY__(x,size)
-# define SIZEIFY__(x,size)     x ## size
+# define SIZEIFY(x)            SIZEIFY_(x, STRACE_UID_SIZE)
+# define SIZEIFY_(x, size)     SIZEIFY__(x, size)
+# define SIZEIFY__(x, size)    x ## size
 
 # define printuid      SIZEIFY(printuid)
 # define sys_chown     SIZEIFY(sys_chown)
@@ -54,7 +55,7 @@
 #include "defs.h"
 
 #ifdef STRACE_UID_SIZE
-# if !NEED_UID16_PARSERS
+# if !HAVE_ARCH_UID16_SYSCALLS
 #  undef STRACE_UID_SIZE
 # endif
 #else
 
 SYS_FUNC(getuid)
 {
-       return RVAL_UDECIMAL | RVAL_DECODED;
+       return RVAL_DECODED;
 }
 
 SYS_FUNC(setfsuid)
 {
        printuid("", tcp->u_arg[0]);
 
-       return RVAL_UDECIMAL | RVAL_DECODED;
+       return RVAL_DECODED;
 }
 
 SYS_FUNC(setuid)
@@ -88,7 +89,8 @@ SYS_FUNC(setuid)
 }
 
 static void
-get_print_uid(struct tcb *tcp, const char *prefix, const long addr)
+get_print_uid(struct tcb *const tcp, const char *const prefix,
+             const kernel_ulong_t addr)
 {
        uid_t uid;
 
@@ -158,14 +160,14 @@ printuid(const char *text, const unsigned int uid)
 static bool
 print_gid(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 {
-       printuid("", (* (uid_t *) elem_buf));
+       printuid("", (*(uid_t *) elem_buf));
 
        return true;
 }
 
 static void
 print_groups(struct tcb *const tcp, const unsigned int len,
-            const kernel_ureg_t addr)
+            const kernel_ulong_t addr)
 {
        static unsigned long ngroups_max;
        if (!ngroups_max)
@@ -178,7 +180,7 @@ print_groups(struct tcb *const tcp, const unsigned int len,
 
        uid_t gid;
        print_array(tcp, addr, len, &gid, sizeof(gid),
-                   umoven_or_printaddr, print_gid, 0);
+                   tfetch_mem, print_gid, 0);
 }
 
 SYS_FUNC(setgroups)