From 4503da0816b0ce0afea54224db6248b2f0a871f1 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 3 Oct 2016 11:59:39 +0000 Subject: [PATCH] Use err_name, print unrecognized errno values as numbers * syscall.c (trace_syscall_exiting): Use err_name() instead of open-coding it. Print unrecognized errno values using %lu format instead of ERRNO_%lu as the latter prodices an invalid constant. --- syscall.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/syscall.c b/syscall.c index a4eb5cd1..90770857 100644 --- a/syscall.c +++ b/syscall.c @@ -887,6 +887,7 @@ trace_syscall_exiting(struct tcb *tcp) struct timeval tv; int res; unsigned long u_error; + const char *u_error_str; /* Measure the exit time as early as possible to avoid errors. */ if (Tflag || cflag) @@ -1028,12 +1029,13 @@ trace_syscall_exiting(struct tcb *tcp) tprints("= ? ERESTART_RESTARTBLOCK (Interrupted by signal)"); break; default: - if (u_error < nerrnos && errnoent[u_error]) - tprintf("= -1 %s (%s)", errnoent[u_error], - strerror(u_error)); + u_error_str = err_name(u_error); + if (u_error_str) + tprintf("= -1 %s (%s)", + u_error_str, strerror(u_error)); else - tprintf("= -1 ERRNO_%lu (%s)", u_error, - strerror(u_error)); + tprintf("= -1 %lu (%s)", + u_error, strerror(u_error)); break; } if ((sys_res & RVAL_STR) && tcp->auxstr) -- 2.50.1