X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fcomstack.c;h=306ec6ddbc7b04dd59cdc27291e50149672cdab6;hp=066fafd48d3be517053641411765f716764962b6;hb=eec02e3b60802638aa3a105f3037814cf32af3b6;hpb=4f75f882c49b802a366ef0b8c528c7e688c53b4b diff --git a/src/comstack.c b/src/comstack.c index 066fafd..306ec6d 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]; } @@ -59,10 +51,14 @@ void cs_get_host_args(const char *type_and_host, const char **args) if (!strncmp(type_and_host, "unix:", 5)) { const char *cp = strchr(type_and_host + 5, ':'); - if (cp) - type_and_host = cp + 1; - else - type_and_host += strlen(type_and_host); /* empty string */ + if (!cp) + return; + type_and_host = cp + 1; + if (!strchr(type_and_host, ':')) + { + *args = type_and_host; /* unix:path:args */ + return; + } } if (*type_and_host) { @@ -73,7 +69,7 @@ void cs_get_host_args(const char *type_and_host, const char **args) cp = strchr(cp + 2, '/'); } if (cp) - *args = cp+1; + *args = cp + 1; } }