]> granicus.if.org Git - strace/commitdiff
keyctl: use printxval_d for printing keyring serial number
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 4 Apr 2018 12:31:09 +0000 (14:31 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 27 Apr 2018 00:56:25 +0000 (00:56 +0000)
* keyctl.c (print_keyring_serial_number): Use printxval_d instead of
looking up and printing xlat value manually.
* xlat/key_spec.in: Add "#val_type int" so the xlat values have sign
bit propagated.

keyctl.c
xlat/key_spec.in

index 9ee08034d6c6e2f53ae49ec3f0585dbc72a6ad09..572b01cce61a1a1e2cd6f8ebc5937fd7c7827a92 100644 (file)
--- a/keyctl.c
+++ b/keyctl.c
@@ -44,12 +44,7 @@ struct keyctl_dh_params {
 static void
 print_keyring_serial_number(key_serial_t id)
 {
-       const char *str = xlookup(key_spec, (unsigned int) id);
-
-       if (str)
-               tprints(str);
-       else
-               tprintf("%d", id);
+       printxval_d(key_spec, id, NULL);
 }
 
 SYS_FUNC(add_key)
index 3e8795446ad89f77d3cc6977a11485fc71511799..02d9ee04475816579405714d6be595bf84f8bd72 100644 (file)
@@ -1,3 +1,4 @@
+#val_type int
 KEY_SPEC_THREAD_KEYRING -1
 KEY_SPEC_PROCESS_KEYRING -2
 KEY_SPEC_SESSION_KEYRING -3