From 92b4f6d610a3b4de9066d4f26a712cf6b1507250 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 14 Sep 2009 15:39:16 +0200 Subject: fixed some minor portability issues --- runtime/msg.c | 4 +++- runtime/stream.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/msg.c b/runtime/msg.c index 2a370618..208ea77a 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -35,7 +35,9 @@ #include #include #include -#include +#if HAVE_MALLOC_H +# include +#endif #include "rsyslog.h" #include "srUtils.h" #include "stringbuf.h" diff --git a/runtime/stream.c b/runtime/stream.c index 605a9771..8098f778 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -961,6 +961,12 @@ finalize_it: * is worth (read: data loss may occur where we otherwise might not * have it). -- rgerhards, 2009-06-08 */ +#undef SYNCCALL +#if HAVE_FDATASYNC +# define SYNCCALL(x) fdatasync(x) +#else +# define SYNCCALL(x) fsync(x) +#endif static rsRetVal syncFile(strm_t *pThis) { @@ -971,7 +977,7 @@ syncFile(strm_t *pThis) FINALIZE; /* TTYs can not be synced */ DBGPRINTF("syncing file %d\n", pThis->fd); - ret = fdatasync(pThis->fd); + ret = SYNCCALL(pThis->fd); if(ret != 0) { char errStr[1024]; int err = errno; @@ -987,7 +993,7 @@ syncFile(strm_t *pThis) finalize_it: RETiRet; } - +#undef SYNCCALL /* physically write to the output file. the provided data is ready for * writing (e.g. zipped if we are requested to do that). -- cgit