[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b4-233-gb78f14c

Service Account noreply at mpich.org
Tue Sep 22 06:06:38 CDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  b78f14c8e3b732817f5772dc88f6a5d1fe56498c (commit)
      from  16e3319b40808591a8f48e2f09e4574c20e38254 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/b78f14c8e3b732817f5772dc88f6a5d1fe56498c

commit b78f14c8e3b732817f5772dc88f6a5d1fe56498c
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Tue Sep 15 21:56:21 2015 -0500

    implement and use MPL_strerror
    
    The mpl printf routines tried to use strerror but we apparently forgot
    to write a configure check for it.  In the unlikely case where strerror
    not available we provide a dead-simple version.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpl/configure.ac b/src/mpl/configure.ac
index 8d348e6..c4e798c 100644
--- a/src/mpl/configure.ac
+++ b/src/mpl/configure.ac
@@ -194,6 +194,12 @@ if test "$ac_cv_func_putenv" = "yes" ; then
     PAC_FUNC_NEEDS_DECL([#include <stdlib.h>],putenv)
 fi
 
+# Check for strerror
+AC_CHECK_FUNCS(strerror)
+if test "$ac_cv_func_strerror" = "yes" ; then
+    PAC_FUNC_NEEDS_DECL([#include <string.h>],strerror)
+fi
+
 dnl Check for ATTRIBUTE
 PAC_C_GNU_ATTRIBUTE
 
diff --git a/src/mpl/include/mplstr.h b/src/mpl/include/mplstr.h
index 0699b15..26cecb6 100644
--- a/src/mpl/include/mplstr.h
+++ b/src/mpl/include/mplstr.h
@@ -48,6 +48,15 @@ extern int strncmp(const char *s1, const char *s2, size_t n);
 #error "strncmp is required"
 #endif /* MPL_HAVE_STRNCMP */
 
+#if defined MPL_NEEDS_STRERROR_DECL
+extern char *strerror(int errnum);
+#endif
+#if defined MPL_HAVE_STRERROR
+#define MPL_strerror strerror
+#else
+char *MPL_strerror(int errnum);
+#endif /* MPL_HAVE_STRERROR */
+
 /* *INDENT-ON* */
 #if defined(__cplusplus)
 }
diff --git a/src/mpl/src/mplmsg.c b/src/mpl/src/mplmsg.c
index 8286569..94a38d9 100644
--- a/src/mpl/src/mplmsg.c
+++ b/src/mpl/src/mplmsg.c
@@ -51,17 +51,10 @@ int MPL_internal_sys_error_printf(const char *name, int errnum, const char *str,
     const char *format_str = 0;
 
     /* Prepend information on the system error */
-#ifdef HAVE_STRERROR
     if (!format_str)
         format_str = "Error in system call %s: %s\n";
 
-    fprintf(stderr, format_str, name, strerror(errnum));
-#else
-    if (!format_str)
-        format_str = "Error in system call %s errno = %d\n";
-
-    fprintf(stderr, "Error in %s: errno = %d\n", name, errnum);
-#endif
+    fprintf(stderr, format_str, name, MPL_strerror(errnum));
 
     /* Now add the message that is specific to this use, if any */
     if (str) {
diff --git a/src/mpl/src/mplstr.c b/src/mpl/src/mplstr.c
index 1f1f8f6..941493b 100644
--- a/src/mpl/src/mplstr.c
+++ b/src/mpl/src/mplstr.c
@@ -298,3 +298,17 @@ char *MPL_strsep(char **stringp, const char *delim)
     }
 }
 
+
+/* there's no standard portable way to convert error codes to human readable
+ * strings.  The standard way to do that is via strerror() but if for some
+ * resason we don't have it, then we'll merely output the error code seen */
+#if !defined MPL_HAVE_STRERROR
+char *MPL_strerror(int errnum)
+{
+#define STRERROR_SIZE 256
+    static char msgbuf[STRERROR_SIZE];
+    snprintf(msgbuf, STRERROR_SIZE, "errno = %d", errnum);
+#undef STRERROR_SIZE
+    return msgbuf;
+}
+#endif /* MPL_HAVE_STRERROR */

-----------------------------------------------------------------------

Summary of changes:
 src/mpl/configure.ac     |    6 ++++++
 src/mpl/include/mplstr.h |    9 +++++++++
 src/mpl/src/mplmsg.c     |    9 +--------
 src/mpl/src/mplstr.c     |   14 ++++++++++++++
 4 files changed, 30 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list