ossp-pkg/sa/sa.c 1.22 -> 1.23
--- sa.c 2001/10/09 18:38:29 1.22
+++ sa.c 2001/10/09 18:55:22 1.23
@@ -357,22 +357,31 @@
int n;
/* argument sanity check */
- if (sa == NULL || str == NULL)
+ if (str == NULL)
return SA_ERR_ARG;
- /* start at begin of buffer */
- cpBuf = sa->szError;
- nBuf = sizeof(sa->szError);
-
/* translate result value into corresponding string */
if (rv == SA_OK) sz = "everything ok";
else if (rv == SA_ERR_ARG) sz = "invalid argument";
- else if (rv == SA_ERR_USE) sz = "invalid use";
- else if (rv == SA_ERR_MEM) sz = "no more memory available";
+ else if (rv == SA_ERR_USE) sz = "invalid use or context";
+ else if (rv == SA_ERR_MEM) sz = "not enough memory available";
+ else if (rv == SA_ERR_MTC) sz = "matching operation failed";
+ else if (rv == SA_ERR_EOF) sz = "communication end";
+ else if (rv == SA_ERR_TMT) sz = "communication timeout";
else if (rv == SA_ERR_SYS) sz = "operating system error";
- else if (rv == SA_ERR_EOF) sz = "end of file in socket communication";
else if (rv == SA_ERR_INT) sz = "internal error";
- else sz = "unknown error";
+ else
+ return SA_ERR_ARG;
+
+ /* if no context is available we have to stop */
+ if (sa == NULL) {
+ *str = sz;
+ return SA_OK;
+ }
+
+ /* start at begin of buffer */
+ cpBuf = sa->szError;
+ nBuf = sizeof(sa->szError);
n = sa_msnprintf(cpBuf, nBuf, "%s", sz);
cpBuf += n;
nBuf -= n;
|
|