aboutsummaryrefslogtreecommitdiffstats
path: root/src/zerror.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/zerror.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/zerror.c b/src/zerror.c
new file mode 100644
index 0000000..c59b092
--- /dev/null
+++ b/src/zerror.c
@@ -0,0 +1,19 @@
+/* See LICENSE file for copyright and license details. */
+#include "internals.h"
+
+
+enum zerror
+zerror(const char **desc)
+{
+ if (libzahl_error >= 0) {
+ if (desc)
+ *desc = strerror(libzahl_error);
+ errno = libzahl_error;
+ return ZERROR_ERRNO_SET;
+ } else {
+ /* Current, we should not be able to get here. */
+ if (desc)
+ abort();
+ return -libzahl_error;
+ }
+}