diff options
Diffstat (limited to 'dhash/examples/dhash_test.c')
-rw-r--r-- | dhash/examples/dhash_test.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/dhash/examples/dhash_test.c b/dhash/examples/dhash_test.c index 8c11227..7b4cbbf 100644 --- a/dhash/examples/dhash_test.c +++ b/dhash/examples/dhash_test.c @@ -35,10 +35,21 @@ int verbose = 0; const char *error_string(int error) { + const char *str; + if (IS_HASH_ERROR(error)) return hash_error_string(error); - return strerror(error); + if (error < 0) { + return "Negative error codes are not supported."; + } + + str = strerror(error); + if (str == NULL) { + return "strerror() returned NULL."; + } + + return str; } char *key_string(hash_key_t *key) |