From a87566fe205c5b32f3fdcd99b5d01d21995e9b98 Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Sun, 27 Sep 1998 00:23:58 +0000 Subject: [PATCH] (error_message): try to pass code to strerror, to see if it might be an errno code (this if broken, but some MIT code seems to expect this behaviour) git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5164 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/com_err/com_err.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/com_err/com_err.c b/lib/com_err/com_err.c index 41a0e8dcd..15533ccc1 100644 --- a/lib/com_err/com_err.c +++ b/lib/com_err/com_err.c @@ -48,16 +48,18 @@ RCSID("$Id$"); struct et_list *_et_list; + const char * error_message (long code) { static char msg[128]; const char *p = com_right(_et_list, code); - if(p){ + if(p == NULL) + p = strerror(code); + if(p != NULL && *p != '\0') strcpy_truncate(msg, p, sizeof(msg)); - } else{ + else snprintf(msg, sizeof(msg), "Unknown error %d", code); - } return msg; }