commit | ca35976927190883368ef3bd32bbf9f174575bd6 | [log] [tgz] |
---|---|---|
author | ajs <ajs> | Fri Nov 19 23:40:16 2004 +0000 |
committer | ajs <ajs> | Fri Nov 19 23:40:16 2004 +0000 |
tree | aa3b9fa981719c48f0418abb06355e88ee39dbcb | |
parent | ff29bb31505b485e8ffa561e21d075d28ac7d5e7 [diff] [blame] |
2004-11-19 David Young <dyoung@pobox.com> * log.c: (safe_strerror) New function: safe wrapper for strerror.
diff --git a/lib/log.c b/lib/log.c index 375730f..b24dacd 100644 --- a/lib/log.c +++ b/lib/log.c
@@ -498,3 +498,11 @@ } return meslist[index].str; } + +/* Wrapper around strerror to handle case where it returns NULL. */ +const char * +safe_strerror(int errnum) +{ + const char *s = strerror(errnum); + return (s != NULL) ? s : "Unknown error"; +}