Comment 65 for bug 407862

Revision history for this message
In , Michael Terry (mterry) wrote :

The change I made was really trivial -- just moved the chown call outside the 'does the output file already exist' check (see https://bugs.launchpad.net/ubuntu/+source/rsyslog/+bug/407862 for gory details):

Index: rsyslog-4.2.0/tools/omfile.c
===================================================================
--- rsyslog-4.2.0.orig/tools/omfile.c 2009-08-31 14:47:37.000000000 -0400
+++ rsyslog-4.2.0/tools/omfile.c 2009-08-31 14:48:30.000000000 -0400
@@ -421,6 +421,7 @@
    */
   pData->fd = open((char*) newFileName, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY|O_CLOEXEC,
     pData->fCreateMode);
+ }
   if(pData->fd != -1) {
    /* check and set uid/gid */
    if(pData->fileUID != (uid_t)-1 || pData->fileGID != (gid_t) -1) {
@@ -438,7 +439,6 @@
     }
    }
   }
- }
 finalize_it:
  /* this was "pData->fd != 0", which I think was a bug. I guess 0 was intended to mean
   * non-open file descriptor. Anyhow, I leave this comment for the time being to that if