]> granicus.if.org Git - strace/commitdiff
keyctl: use printuid for printing UID/GID
authorEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 29 Sep 2016 12:56:02 +0000 (15:56 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 2 Oct 2016 19:19:15 +0000 (19:19 +0000)
UID/GID are unsigned except special -1 value (which is also special in
context of specific keyctl commands), so special printing function
should be used.

* keyctl.c (keyctl_chown_key, keyctl_get_persistent): Use printuid
instead of printf with "%d" conversion for printing UID/GID.

keyctl.c

index 456649e56e406546ac02809a3b8055e6d7e62a5c..dc1d10e65e3b13c3eb352c78f91a0e16c11cb4a6 100644 (file)
--- a/keyctl.c
+++ b/keyctl.c
@@ -136,7 +136,8 @@ static void
 keyctl_chown_key(struct tcb *tcp, key_serial_t id, int user, int group)
 {
        print_keyring_serial_number(id);
-       tprintf(", %d, %d", user, group);
+       printuid(", ", user);
+       printuid(", ", group);
 }
 
 static void
@@ -189,7 +190,8 @@ keyctl_set_timeout(struct tcb *tcp, key_serial_t id, unsigned timeout)
 static void
 keyctl_get_persistent(struct tcb *tcp, int uid, key_serial_t id)
 {
-       tprintf("%d, ", uid);
+       printuid("", uid);
+       tprints(", ");
        print_keyring_serial_number(id);
 }