filelog: Ignore flush_line option if setlinebuf() not supported
authorMartin Willi <martin@revosec.ch>
Tue, 29 Oct 2013 09:58:39 +0000 (10:58 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 13:53:04 +0000 (15:53 +0200)
configure.ac
src/libcharon/bus/listeners/file_logger.c

index 0dc5ac6..e3e4f88 100644 (file)
@@ -568,7 +568,7 @@ AC_CHECK_FUNC(
 )
 
 AC_CHECK_FUNCS(prctl mallinfo getpass closefrom getpwnam_r getgrnam_r getpwuid_r)
-AC_CHECK_FUNCS(fmemopen funopen mmap memrchr syslog)
+AC_CHECK_FUNCS(fmemopen funopen mmap memrchr syslog setlinebuf)
 
 AC_CHECK_HEADERS(sys/sockio.h glob.h net/if_tun.h linux/fib_rules.h)
 AC_CHECK_HEADERS(net/pfkeyv2.h netipsec/ipsec.h netinet6/ipsec.h linux/udp.h)
index 68a386d..c86cff1 100644 (file)
@@ -214,10 +214,12 @@ METHOD(file_logger_t, open_, void,
                                 this->filename, strerror(errno));
                        return;
                }
+#ifdef HAVE_SETLINEBUF
                if (flush_line)
                {
                        setlinebuf(file);
                }
+#endif /* HAVE_SETLINEBUF */
        }
        this->lock->write_lock(this->lock);
        close_file(this);