From d5dcedec28a48ae3b1eb8151eb4f8070ff92b3e4 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Thu, 5 Dec 2013 23:13:44 +0100 Subject: [PATCH] Use POSIX setvbuf in preference to BSD setlinebuf. This avoids implicit declaration of setlinebuf with GNU libc, which would have required to define _BSD_SOURCE just to get rid of, and is not an innocuous setting. Drop call to no-op AC_FUNC_SETVBUF_REVERSED at the same time. --- configure.ac | 3 +-- gnushogi/rawdsp.c | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index bae9d3d..923ec35 100644 --- a/configure.ac +++ b/configure.ac @@ -103,12 +103,11 @@ AC_MSG_NOTICE([library functions]) AC_FUNC_FORK AC_PROG_GCC_TRADITIONAL AC_FUNC_MALLOC -AC_FUNC_SETVBUF_REVERSED AC_TYPE_SIGNAL AC_CHECK_FUNCS([dup2 gethostname gettimeofday memset pow strcasecmp]) AC_CHECK_FUNCS([strchr strerror strrchr strstr strtol]) AC_CHECK_FUNCS([memcpy bcopy]) -AC_CHECK_FUNCS([setlinebuf setvbuf]) +AC_CHECK_FUNCS([setvbuf setlinebuf]) # diff --git a/gnushogi/rawdsp.c b/gnushogi/rawdsp.c index 5c4d45d..8337d41 100644 --- a/gnushogi/rawdsp.c +++ b/gnushogi/rawdsp.c @@ -223,13 +223,13 @@ Raw_Initialize(void) /* needed because of inconsistency between MSVC run-time system and gcc includes */ setbuf(stdout, NULL); #else -#ifdef HAVE_SETLINEBUF - setlinebuf(stdout); -#else -# ifdef HAVE_SETVBUF +#ifdef HAVE_SETVBUF setvbuf(stdout, NULL, _IOLBF, BUFSIZ); +#else +# ifdef HAVE_SETLINEBUF + setlinebuf(stdout); # else -# error "Need setlinebuf() or setvbuf() to compile gnushogi!" +# error "Need setvbuf() or setlinebuf() to compile gnushogi!" # endif #endif #endif -- 1.7.0.4