[PATCH 5/8] keyctl: Print errno name in KEYCTL_REJECT in case it is available

Eugene Syromyatnikov evgsyr at gmail.com
Thu Sep 29 12:56:35 UTC 2016


* keyctl.c (keyctl_reject_key): Get errno string via err_name and print
  it if it is not NULL.
---
 keyctl.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/keyctl.c b/keyctl.c
index c9081b7..1fb1da5 100644
--- 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);
 }
 
-- 
1.7.10.4





More information about the Strace-devel mailing list