From: Dave Hart Date: Fri, 14 Jan 2011 07:50:28 +0000 (+0000) Subject: Correct msyslog.c build break on Solaris 2.9 from #ifdef/#if mixup. X-Git-Tag: NTP_4_2_7P119~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20f24967bba2a187ec3f9e1dd3ff451b449e3e5f;p=thirdparty%2Fntp.git Correct msyslog.c build break on Solaris 2.9 from #ifdef/#if mixup. bk: 4d300044CIATJKL6lE9LHtH_5owp9A --- diff --git a/ChangeLog b/ChangeLog index 07f51dd6b..7fa7d58f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* Correct msyslog.c build break on Solaris 2.9 from #ifdef/#if mixup. (4.2.7p117) 2011/01/13 Released by Harlan Stenn * Add configure --without-sntp option to disable building sntp and sntp/tests. withsntp=no in the environment changes the default. diff --git a/libntp/msyslog.c b/libntp/msyslog.c index 47e3492da..6b3453632 100644 --- a/libntp/msyslog.c +++ b/libntp/msyslog.c @@ -54,19 +54,28 @@ errno_to_str( size_t bufsiz ) { +# if defined(STRERROR_R_CHAR_P) || !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 */