]> granicus.if.org Git - strace/commitdiff
keyctl: print errno name in KEYCTL_REJECT in case it is available
authorEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 29 Sep 2016 12:56:35 +0000 (15:56 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 3 Oct 2016 12:03:03 +0000 (12:03 +0000)
* keyctl.c (keyctl_reject_key): Get errno string via err_name
and print it if it is not NULL.

keyctl.c

index b2099df8875e85f46f3767dcbb6d5919da11d313..894af62b03303a57be8a3c18751af8cb10104db7 100644 (file)
--- a/keyctl.c
+++ b/keyctl.c
@@ -175,8 +175,16 @@ static void
 keyctl_reject_key(struct tcb *tcp, key_serial_t id1, unsigned timeout,
                  unsigned error, key_serial_t id2)
 {
+       const char *err_str = err_name(error);
+
        print_keyring_serial_number(id1);
-       tprintf(", %u, %u, ", timeout, error);
+       tprintf(", %u, ", timeout);
+
+       if (err_str)
+               tprintf("%s, ", err_str);
+       else
+               tprintf("%u, ", error);
+
        print_keyring_serial_number(id2);
 }