From 078ac9ebd245ab061726b49c41218549665dc61e Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Mon, 17 Nov 2003 10:40:56 +0000 Subject: [PATCH] Include system-level error message in cs_errmsg() output when appropriate --- src/comstack.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/comstack.c b/src/comstack.c index 4d842f7..640b09b 100644 --- a/src/comstack.c +++ b/src/comstack.c @@ -2,11 +2,12 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: comstack.c,v 1.1 2003-10-27 12:21:30 adam Exp $ + * $Id: comstack.c,v 1.2 2003-11-17 10:40:56 mike Exp $ */ #include #include +#include #include #include @@ -26,8 +27,16 @@ static const char *cs_errlist[] = const char *cs_errmsg(int n) { - if (n < 0 || n > 6) - n = 0; + static char buf[250]; + + if (n < CSNONE || n > CSLASTERROR) { + sprintf(buf, "unknown comstack error %d", n); + return buf; + } + if (n == CSYSERR) { + sprintf(buf, "%s: %s", cs_errlist[n], strerror(errno)); + return buf; + } return cs_errlist[n]; } -- 1.7.10.4