#! /bin/sh /usr/share/dpatch/dpatch-run ## 52_bootlogd_createlogfile.dpatch by ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad --exclude=CVS --exclude=.svn ./man/bootlogd.8 /tmp/dpep-work.PNSf00/trunk/man/bootlogd.8 --- ./man/bootlogd.8 2006-03-19 17:51:42.000000000 +0100 +++ /tmp/dpep-work.PNSf00/trunk/man/bootlogd.8 2006-03-19 17:51:42.000000000 +0100 @@ -3,6 +3,7 @@ bootlogd \- record boot messages .SH SYNOPSIS .B /sbin/bootlogd +.RB [ \-c ] .RB [ \-d ] .RB [ \-r ] .RB [ \-s ] @@ -16,6 +17,12 @@ .SH OPTIONS .IP \fB\-d\fP Do not fork and run in the background. +.IP \fB\-c\fP +Attempt to write to the logfile even if it does not yet exist. +Without this option, +.B bootlogd +will wait for the logfile to appear before attempting to write to it. +This behavior prevents bootlogd from creating logfiles under mount points. .IP \fB\-r\fP If there is an existing logfile called \fIlogfile\fP rename it to \fIlogfile~\fP unless \fIlogfile~\fP already exists. diff -urNad --exclude=CVS --exclude=.svn ./src/bootlogd.c /tmp/dpep-work.PNSf00/trunk/src/bootlogd.c --- ./src/bootlogd.c 2006-03-19 17:51:42.000000000 +0100 +++ /tmp/dpep-work.PNSf00/trunk/src/bootlogd.c 2006-03-19 17:52:39.000000000 +0100 @@ -56,6 +56,7 @@ int got_signal = 0; int didnl = 1; +int createlogfile = 0; int syncalot = 0; struct line { @@ -385,7 +386,7 @@ */ void usage(void) { - fprintf(stderr, "Usage: bootlogd [-v] [-r] [-d] [-p pidfile] [-l logfile]\n"); + fprintf(stderr, "Usage: bootlogd [-v] [-r] [-d] [-s] [-c] [-p pidfile] [-l logfile]\n"); exit(1); } @@ -447,7 +448,7 @@ rotate = 0; dontfork = 0; - while ((i = getopt(argc, argv, "dsl:p:rv")) != EOF) switch(i) { + while ((i = getopt(argc, argv, "cdsl:p:rv")) != EOF) switch(i) { case 'l': logfile = optarg; break; @@ -461,6 +462,9 @@ case 'p': pidfile = optarg; break; + case 'c': + createlogfile = 1; + break; case 'd': dontfork = 1; break; @@ -613,12 +617,16 @@ /* * Perhaps we need to open the logfile. */ - if (fp == NULL && rotate && access(logfile, F_OK) == 0) { - snprintf(buf, sizeof(buf), "%s~", logfile); - rename(logfile, buf); + if (fp == NULL && access(logfile, F_OK) == 0) { + if (rotate) { + snprintf(buf, sizeof(buf), "%s~", logfile); + rename(logfile, buf); + } + fp = fopen(logfile, "a"); } - if (fp == NULL) + if (fp == NULL && createlogfile) fp = fopen(logfile, "a"); + if (inptr >= outptr) todo = inptr - outptr; else