changeset 15984:38d63be28832

perror: Recognize when test program crashes. * m4/perror.m4 (gl_FUNC_PERROR): If the test program crashes due to strerror, set gl_cv_func_perror_works to no. Reported by Daniel Richard G. <skunk@iskunk.org>.
author Bruno Haible <bruno@clisp.org>
date Sat, 22 Oct 2011 14:25:26 +0200
parents 19adf9aa1ea0
children 42b40ee9f878
files ChangeLog m4/perror.m4
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-10-22  Bruno Haible  <bruno@clisp.org>
 
+	perror: Recognize when test program crashes.
+	* m4/perror.m4 (gl_FUNC_PERROR): If the test program crashes due to
+	strerror, set gl_cv_func_perror_works to no.
+	Reported by Daniel Richard G. <skunk@iskunk.org>.
+
 	perror: Fix indentation.
 	* m4/perror.m4 (gl_FUNC_PERROR): Fix indentation.
 
--- a/m4/perror.m4
+++ b/m4/perror.m4
@@ -1,4 +1,4 @@
-# perror.m4 serial 5
+# perror.m4 serial 6
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -36,9 +36,10 @@
                 puts (str);
                 errno = -1;
                 perror ("");
+                return 0;
               ]])],
-           [CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2
-            if cmp conftest.txt1 conftest.txt2 >/dev/null; then
+           [if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 \
+               && cmp conftest.txt1 conftest.txt2 >/dev/null; then
               gl_cv_func_perror_works=yes
             else
               gl_cv_func_perror_works=no