aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2020-04-21 00:39:44 -0400
committerGitHub <noreply@github.com>2020-04-21 00:39:44 -0400
commitd78903961ee95376bccde7c1313be5b583911ab7 (patch)
tree143bfb96e78b6a4efcc4949b077d3d747f8f8c13 /lib
parent110489259c0696c0cee5bec6ad7695a0c93d4e74 (diff)
parentf7fd09d92a3f819cf815125a1c898c572b94d33c (diff)
downloadspmc-d78903961ee95376bccde7c1313be5b583911ab7.tar.gz
Merge pull request #29 from jhunkeler/tests-errors
Ignore NULL reasons + tests
Diffstat (limited to 'lib')
-rw-r--r--lib/error_handler.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/error_handler.c b/lib/error_handler.c
index 4e06919..cb2ef51 100644
--- a/lib/error_handler.c
+++ b/lib/error_handler.c
@@ -16,13 +16,19 @@ const char *SPM_ERR_STRING[] = {
NULL,
};
+/**
+ * Append error text to an existing spmerrno error string
+ * @param reason message text
+ */
void spmerrno_cause(const char *reason) {
char *buf = spmerrbuf_reason;
- sprintf(buf, " (%s)", reason);
- return;
+ if (reason != NULL) {
+ sprintf(buf, " (%s)", reason);
+ }
}
+
/**
- *
+ * Translate a spmerrno code to an error string
* @param code
* @return
*/