diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-03-04 23:50:00 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-03-04 23:50:00 +0100 |
| commit | 76d0af5599554d11f104d582cdac8fbaa8569fcc (patch) | |
| tree | 0ed9889a86d52ebd208382f2fd49dad0570d1f8c /src/zerror.c | |
| parent | Clean up, fix a few bugs, and add a test (diff) | |
| download | libzahl-76d0af5599554d11f104d582cdac8fbaa8569fcc.tar.gz libzahl-76d0af5599554d11f104d582cdac8fbaa8569fcc.tar.bz2 libzahl-76d0af5599554d11f104d582cdac8fbaa8569fcc.tar.xz | |
Clean up, add zerror and zperror, fix bugs and add more tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/zerror.c')
| -rw-r--r-- | src/zerror.c | 19 |
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; + } +} |
