From: Mike Taylor Date: Mon, 17 Nov 2003 10:40:56 +0000 (+0000) Subject: Include system-level error message in cs_errmsg() output when appropriate X-Git-Tag: YAZ.2.0.6~41 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=078ac9ebd245ab061726b49c41218549665dc61e Include system-level error message in cs_errmsg() output when appropriate --- 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]; }