[syslog-ng] [PATCH] logproto: Fix compilation on systems without IOV_MAX.

Gergely Nagy algernon at balabit.hu
Fri Nov 18 15:13:03 CET 2011


Since IOV_MAX is not defined on Hurd its usage is made conditional.
Errors are handled by g_malloc0() which aborts on failure, so no
return value has to be checked.

Reported-By: Svante Signell <svante.signell at telia.com>
Patch-From: Svante Signell <svante.signell at telia.com>
Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 lib/logproto.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/logproto.c b/lib/logproto.c
index 282064c..16ca0d7 100644
--- a/lib/logproto.c
+++ b/lib/logproto.c
@@ -420,9 +420,11 @@ log_proto_file_writer_new(LogTransport *transport, gint flush_lines)
   if (flush_lines == 0)
     /* the flush-lines option has not been specified, use a default value */
     flush_lines = 1;
+#ifdef IOV_MAX
   if (flush_lines > IOV_MAX)
     /* limit the flush_lines according to the current platform */
     flush_lines = IOV_MAX;
+#endif
 
   /* allocate the structure with the proper number of items at the end */
   LogProtoFileWriter *self = (LogProtoFileWriter *)g_malloc0(sizeof(LogProtoFileWriter) + sizeof(struct iovec)*flush_lines);
-- 
1.7.7.3




More information about the syslog-ng mailing list