On 07/14/2014 09:52 AM, Ruediger Pluem wrote:


jkal...@apache.org wrote:
Author: jkaluza
Date: Mon Jul 14 05:52:45 2014
New Revision: 1610339

URL: http://svn.apache.org/r1610339
Log:
mod_journald: New module implementing error_log provider for systemd-journald.

Added:
     httpd/httpd/trunk/docs/manual/mod/mod_journald.xml   (with props)
     httpd/httpd/trunk/modules/loggers/mod_journald.c
Modified:
     httpd/httpd/trunk/modules/loggers/config.m4


Added: httpd/httpd/trunk/modules/loggers/mod_journald.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_journald.c?rev=1610339&view=auto
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_journald.c (added)
+++ httpd/httpd/trunk/modules/loggers/mod_journald.c Mon Jul 14 05:52:45 2014

+static apr_status_t journald_log_writer(request_rec *r,
+                           void *handle,
+                           const char **strs,
+                           int *strl,
+                           int nelts,
+                           apr_size_t len)
+
+{
+    char *str;
+    char *s;
+    int i;
+    apr_status_t rv = APR_SUCCESS;
+
+    str = apr_palloc(r->pool, len + 1);

Why +1?

That's taken from ap_default_log_writer(...) and it's also in ap_buffered_log_writer(...). When thinking about it now, it's probably useless, because "len" is sum of strlen() of each string in strs, so it does not include '\0', but my log_writer (and also the ap_default_log_writer/ap_buffered_log_writer) does not actually use/set that last zero byte.

I think we can remove that "len + 1" in all three cases then?

Jan Kaluza

Regards

Rüdiger


Reply via email to