From: Harlan Stenn Date: Wed, 12 Jan 2011 23:57:28 +0000 (-0500) Subject: Some systems do not have strerror_r X-Git-Tag: NTP_4_2_7P117~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=172b02ca316b5d97432c0ef1c17e8ceee0ef0829;p=thirdparty%2Fntp.git Some systems do not have strerror_r bk: 4d2e3fe8eia2yLXFhAYROysAzrjHXQ --- diff --git a/libntp/msyslog.c b/libntp/msyslog.c index d90e72850..47e3492da 100644 --- a/libntp/msyslog.c +++ b/libntp/msyslog.c @@ -54,28 +54,19 @@ errno_to_str( size_t bufsiz ) { -# if defined(STRERROR_R_CHAR_P) || !defined(HAVE_DECL_STRERROR_R) char * pstatic; -# ifdef STRERROR_R_CHAR_P +# ifdef STRERROR_R_CHAR_P /* * For older GNU strerror_r, the return value either points to * buf, or to static storage. We want the result always in buf */ pstatic = strerror_r(err, buf, bufsiz); -# else +# else pstatic = strerror(err); -# endif +# endif if (pstatic != buf) strncpy(buf, pstatic, bufsiz); -# else - int rc; - - rc = strerror_r(err, buf, bufsiz); - if (rc < 0) - snprintf(buf, bufsiz, "strerror_r(%d): errno %d", - err, errno); -# endif } #endif /* errno_to_str */