Commit d90b362f authored by unknown's avatar unknown

small fix after bar's code review

parent 4b6eb9b0
...@@ -578,19 +578,14 @@ const char *ndberror_classification_message(ndberror_classification classificati ...@@ -578,19 +578,14 @@ const char *ndberror_classification_message(ndberror_classification classificati
int ndb_error_string(int err_no, char *str, size_t size) int ndb_error_string(int err_no, char *str, size_t size)
{ {
ndberror_struct error; ndberror_struct error;
size_t len= 0, tlen= 0; size_t len;
error.code = err_no; error.code = err_no;
ndberror_update(&error); ndberror_update(&error);
len+= snprintf(str+tlen, size-tlen, "%s", error.message); len = snprintf(str, size-1, "%s: %s: %s", error.message,
tlen= len < size ? len : size; ndberror_status_message(error.status), ndberror_classification_message(error.classification));
len+= snprintf(str+tlen, size-tlen, ": "); str[size-1]= '\0';
tlen= len < size ? len : size;
len+= snprintf(str+tlen, size-tlen, "%s", ndberror_status_message(error.status));
tlen= len < size ? len : size;
len+= snprintf(str+tlen, size-tlen, ": ");
tlen= len < size ? len : size;
len+= snprintf(str+tlen, size-tlen, "%s", ndberror_classification_message(error.classification));
return len; return len;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment