From: Adam Dickmeiss Date: Wed, 7 Oct 2015 14:06:25 +0000 (+0200) Subject: cs_errmsg never writes to static buffer X-Git-Tag: v5.14.11~3 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=39671a069c30f6cc508de7692f49a01f413a5a16;ds=sidebyside cs_errmsg never writes to static buffer For the CSYSERR applications should check errno themselves --- diff --git a/src/comstack.c b/src/comstack.c index 066fafd..9d46728 100644 --- a/src/comstack.c +++ b/src/comstack.c @@ -35,16 +35,8 @@ static const char *cs_errlist[] = const char *cs_errmsg(int n) { - 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; - } + if (n < CSNONE || n > CSLASTERROR) + n = CSNONE; return cs_errlist[n]; }