Ticket #481 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

A newline is added to the syslog string

Reported by: c00chm@… Owned by: jan
Priority: low Milestone:
Component: mod_accesslog Version: 1.4.8
Severity: normal Keywords:
Cc: Blocked By:
Need User Feedback: Blocking:

Description (last modified by jan) (diff)

When using syslog() the newline at the end should be stripped away. Now i get empty lines in my syslog files.

Something like this:

--- mod_accesslog.c.orig    2006-01-21 00:04:19.000000000 +0100
+++ mod_accesslog.c 2006-01-21 00:17:56.000000000 +0100
@@ -334,7 +334,7 @@
            if (s->access_logbuffer->used) {
                if (s->use_syslog) {
 # ifdef HAVE_SYSLOG_H
-                   syslog(LOG_INFO, "%*s", s->access_logbuffer->used - 1, s->access_logbuffer->ptr);
+                   syslog(LOG_INFO, "%*s", s->access_logbuffer->used - 2, s->access_logbuffer->ptr);
 # endif
                } else if (s->log_access_fd != -1) {
                    write(s->log_access_fd, s->access_logbuffer->ptr, s->access_logbuffer->used - 1);
@@ -813,7 +813,7 @@
        b->used > BUFFER_MAX_REUSE_SIZE) {
        if (p->conf.use_syslog) {
 #ifdef HAVE_SYSLOG_H
-           syslog(LOG_INFO, "%*s", b->used - 1, b->ptr);
+           syslog(LOG_INFO, "%*s", b->used - 2, b->ptr);
 #endif
        } else if (p->conf.log_access_fd != -1) {
            write(p->conf.log_access_fd, b->ptr, b->used - 1);

It seems that my syslog can handle %*s, with printf i have to use %.*s to get the string stripped. I am using the Debian GNU/Linux unstable package.

Attachments

Change History

Changed 3 years ago by jan

  • status changed from new to assigned
  • description modified (diff)

Changed 3 years ago by jan

  • status changed from assigned to closed
  • resolution set to fixed

fixed in [963]

Add/Change #481 (A newline is added to the syslog string)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.