From: Arran Cudbard-Bell Date: Mon, 16 Nov 2015 19:44:41 +0000 (-0500) Subject: Provide fdprintf if it's missing Closes #1366 X-Git-Tag: release_3_0_11~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f542301cda8908f5c230f79d4f2eecdceea966a;p=thirdparty%2Ffreeradius-server.git Provide fdprintf if it's missing Closes #1366 --- diff --git a/configure b/configure index 567245c15c8..664cf4ad6f1 100755 --- a/configure +++ b/configure @@ -9937,45 +9937,52 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext for ac_func in \ - getopt_long \ - fcntl \ - strsignal \ - sigaction \ - sigprocmask \ - pthread_sigmask \ - snprintf \ - vsnprintf \ - setsid \ - strncasecmp \ - strcasecmp \ - localtime_r \ + bindat \ + clock_gettime \ + closefrom \ ctime_r \ + dladdr \ + fcntl \ + fopencookie \ + funopen \ + getaddrinfo \ + getnameinfo \ + getopt_long \ + getpeereid \ + getresuid \ + gettimeofday \ + getusershell \ gmtime_r \ - strsep \ + if_indextoname \ inet_aton \ - inet_pton \ inet_ntop \ + inet_pton \ + initgroups \ + kqueue \ + localtime_r \ mallopt \ + mkdirat \ + openat \ + pthread_sigmask \ setlinebuf \ - setvbuf \ - getusershell \ - initgroups \ - getaddrinfo \ - getnameinfo \ - closefrom \ - gettimeofday \ - getpeereid \ - setuid \ setresuid \ - getresuid \ + setsid \ + setuid \ + setvbuf \ + sigaction \ + sigprocmask \ + snprintf \ + strcasecmp \ strlcat \ strlcpy \ - kqueue \ - openat \ - mkdirat \ + strncasecmp \ + strsep \ + strsignal \ unlinkat \ bindat \ dladdr + vdprintf \ + vsnprintf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/configure.ac b/configure.ac index 23eeb7faf3c..5e86ca1954c 100644 --- a/configure.ac +++ b/configure.ac @@ -1433,45 +1433,52 @@ dnl # 5. Checks for structures and functions dnl # dnl ############################################################# AC_CHECK_FUNCS( \ - getopt_long \ - fcntl \ - strsignal \ - sigaction \ - sigprocmask \ - pthread_sigmask \ - snprintf \ - vsnprintf \ - setsid \ - strncasecmp \ - strcasecmp \ - localtime_r \ + bindat \ + clock_gettime \ + closefrom \ ctime_r \ + dladdr \ + fcntl \ + fopencookie \ + funopen \ + getaddrinfo \ + getnameinfo \ + getopt_long \ + getpeereid \ + getresuid \ + gettimeofday \ + getusershell \ gmtime_r \ - strsep \ + if_indextoname \ inet_aton \ - inet_pton \ inet_ntop \ + inet_pton \ + initgroups \ + kqueue \ + localtime_r \ mallopt \ + mkdirat \ + openat \ + pthread_sigmask \ setlinebuf \ - setvbuf \ - getusershell \ - initgroups \ - getaddrinfo \ - getnameinfo \ - closefrom \ - gettimeofday \ - getpeereid \ - setuid \ setresuid \ - getresuid \ + setsid \ + setuid \ + setvbuf \ + sigaction \ + sigprocmask \ + snprintf \ + strcasecmp \ strlcat \ strlcpy \ - kqueue \ - openat \ - mkdirat \ + strncasecmp \ + strsep \ + strsignal \ unlinkat \ bindat \ dladdr + vdprintf \ + vsnprintf ) AC_TYPE_SIGNAL diff --git a/src/include/autoconf.h.in b/src/include/autoconf.h.in index db9d41d424c..a637c68577d 100644 --- a/src/include/autoconf.h.in +++ b/src/include/autoconf.h.in @@ -54,6 +54,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CAPABILITY_H +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + /* Define to 1 if you have the `closefrom' function. */ #undef HAVE_CLOSEFROM @@ -101,6 +104,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FNMATCH_H +/* Define to 1 if you have the `fopencookie' function. */ +#undef HAVE_FOPENCOOKIE + +/* Define to 1 if you have the `funopen' function. */ +#undef HAVE_FUNOPEN + /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO @@ -149,6 +158,9 @@ /* Define if the function (or macro) htonlll exists. */ #undef HAVE_HTONLLL +/* Define to 1 if you have the `if_indextoname' function. */ +#undef HAVE_IF_INDEXTONAME + /* define if you have IN6_PKTINFO (Linux) */ #undef HAVE_IN6_PKTINFO @@ -484,6 +496,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UTMP_H +/* Define to 1 if you have the `vdprintf' function. */ +#undef HAVE_VDPRINTF + /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF diff --git a/src/include/missing-h b/src/include/missing-h index b0960f66df3..650d27783fe 100644 --- a/src/include/missing-h +++ b/src/include/missing-h @@ -351,6 +351,10 @@ size_t strlcat(char *dst, char const *src, size_t siz); struct tm *gmtime_r(time_t const *l_clock, struct tm *result); #endif +#ifndef HAVE_VDPRINTF +int vdprintf (int fd, const char format, va_list args); +#endif + #ifndef HAVE_GETTIMEOFDAY int gettimeofday (struct timeval *tv, void *tz); #endif diff --git a/src/lib/missing.c b/src/lib/missing.c index 4c45fb40b10..084c07b33d1 100644 --- a/src/lib/missing.c +++ b/src/lib/missing.c @@ -191,6 +191,22 @@ struct tm *gmtime_r(time_t const *l_clock, struct tm *result) } #endif +#ifndef HAVE_VDPRINTF +int vdprintf (int fd, const char format, va_list args) +{ + int ret; + FILE *fp; + + fp = fdopen(fd, "w"); + if (!fp) return -1; + + ret = vfprintf(fp, format, args); + fclose(fp); + + return ret; +} +#endif + #ifndef HAVE_GETTIMEOFDAY #ifdef WIN32 /*