From c7aa985104d9e2787820304b0f82ef7866e0f9e1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 27 Oct 2007 00:41:22 +0200 Subject: [PATCH] Change strerror so that it never returns an empty string. --- ChangeLog | 5 +++++ lib/strerror.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 877b665385..e5ea16c6df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-26 Bruno Haible + + * lib/strerror.c (rpl_strerror): Return "Unknown error ..." also if + strerror returned the empty string. Needed on HP-UX 11.00. + 2007-10-24 Micah Cowan Remove vestiges of cvs-gnulib-checkout process. Now we use git. diff --git a/lib/strerror.c b/lib/strerror.c index 9b9ffd104d..9fe437db78 100644 --- a/lib/strerror.c +++ b/lib/strerror.c @@ -35,7 +35,7 @@ rpl_strerror (int n) { char *result = strerror (n); - if (! result) + if (result == NULL || result[0] == '\0') { static char const fmt[] = "Unknown error (%d)"; static char mesg[sizeof fmt + INT_STRLEN_BOUND (n)]; -- 2.30.2