bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] strerror_r: fix includes for FreeBSD


From: Eric Blake
Subject: [PATCH] strerror_r: fix includes for FreeBSD
Date: Wed, 1 Jun 2011 08:16:28 -0600

* lib/strerror_r.c (includes): Use <stdlib.h> unconditionally,
since we use abort on some platforms.
Reported by Matthias Bolte.

Signed-off-by: Eric Blake <address@hidden>
---

> Adding an unconditional include for stdlib.h fixes this problem. The
> file already contains an include for stdlib.h under some condition, so
> I'm not sure where in the condition tree to stick the include to fix
> this problem properly.

Thanks for the report.  The simplest solution is to forget about
conditional inclusion entirely, so I did that instead.

 ChangeLog        |    7 +++++++
 lib/strerror_r.c |    4 +---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a8fc9fa..748dd3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-01  Eric Blake  <address@hidden>
+
+       strerror_r: fix includes for FreeBSD
+       * lib/strerror_r.c (includes): Use <stdlib.h> unconditionally,
+       since we use abort on some platforms.
+       Reported by Matthias Bolte.
+
 2011-05-31  Bruno Haible  <address@hidden>

        Fix link errors in tests: openat-die uses gettext-h.
diff --git a/lib/strerror_r.c b/lib/strerror_r.c
index 494b1f0..f9242e3 100644
--- a/lib/strerror_r.c
+++ b/lib/strerror_r.c
@@ -27,6 +27,7 @@

 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>

 #if GNULIB_defined_ESOCK /* native Windows platforms */
 # if HAVE_WINSOCK2_H
@@ -82,9 +83,6 @@ extern char *sys_errlist[];
 extern int sys_nerr;
 #  endif

-/* Get sys_nerr, sys_errlist on native Windows.  */
-#  include <stdlib.h>
-
 # else

 #  include "glthread/lock.h"
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]