~ubuntu-branches/debian/experimental/sysvinit/experimental

« back to all changes in this revision

Viewing changes to debian/patches/52_bootlogd_createlogfile.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Petter Reinholdtsen
  • Date: 2008-08-12 16:07:50 UTC
  • Revision ID: james.westby@ubuntu.com-20080812160750-65gpyv74vh4qr69w
Tags: 2.86.ds1-61
* Fix typo in rcS(5), proberly->properly (Closes: #484233).  Thanks to
  Julien Danjou for noticing.
* Fix typo in rcS(5), maually->manually (Closes: #493680).  Thanks to
  Xr for noticing.
* Modify runlevel detection code in invoke-rc.d to notice the
  difference between runlevels 0 and 6, and the boot runlevel, to
  make it possible to use invoke-rc.d during boot (Closes: 384509).
* Make sure to call restorecon after mounting tmpfs file systems, to
  set SELinux permissions (Closes: #493679).  Patch from Russell
  Coker.
* Move responsibility of stopping the splash screen process from
  individual init.d scripts to init.d/rc.  This make sure the
  progress calculation reflect reality, and that the splash screen
  is taken down in runlevel 1 (Closes: #431560) and that it stop
  before gdm and kdm (Closes: #422922, #489734).
* Skip error message from checkfs.sh when / is read-only.  Patch
  from Mirek Slugen (Closes: #492214).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 52_bootlogd_createlogfile.dpatch by  <jdthood@yahoo.co.uk>
 
3
##
 
4
## All lines beginning with `## DP:' are a description of the patch.
 
5
## DP: No description.
 
6
 
 
7
@DPATCH@
 
8
diff -urNad --exclude=CVS --exclude=.svn ./man/bootlogd.8 /tmp/dpep-work.PNSf00/trunk/man/bootlogd.8
 
9
--- ./man/bootlogd.8    2006-03-19 17:51:42.000000000 +0100
 
10
+++ /tmp/dpep-work.PNSf00/trunk/man/bootlogd.8  2006-03-19 17:51:42.000000000 +0100
 
11
@@ -3,6 +3,7 @@
 
12
 bootlogd \- record boot messages
 
13
 .SH SYNOPSIS
 
14
 .B /sbin/bootlogd
 
15
+.RB [ \-c ]
 
16
 .RB [ \-d ]
 
17
 .RB [ \-r ]
 
18
 .RB [ \-s ]
 
19
@@ -16,6 +17,12 @@
 
20
 .SH OPTIONS
 
21
 .IP \fB\-d\fP
 
22
 Do not fork and run in the background.
 
23
+.IP \fB\-c\fP
 
24
+Attempt to write to the logfile even if it does not yet exist.
 
25
+Without this option,
 
26
+.B bootlogd
 
27
+will wait for the logfile to appear before attempting to write to it.
 
28
+This behavior prevents bootlogd from creating logfiles under mount points.
 
29
 .IP \fB\-r\fP
 
30
 If there is an existing logfile called \fIlogfile\fP rename it to
 
31
 \fIlogfile~\fP unless \fIlogfile~\fP already exists.
 
32
diff -urNad --exclude=CVS --exclude=.svn ./src/bootlogd.c /tmp/dpep-work.PNSf00/trunk/src/bootlogd.c
 
33
--- ./src/bootlogd.c    2006-03-19 17:51:42.000000000 +0100
 
34
+++ /tmp/dpep-work.PNSf00/trunk/src/bootlogd.c  2006-03-19 17:52:39.000000000 +0100
 
35
@@ -56,6 +56,7 @@
 
36
 
 
37
 int got_signal = 0;
 
38
 int didnl = 1;
 
39
+int createlogfile = 0;
 
40
 int syncalot = 0;
 
41
 
 
42
 struct line {
 
43
@@ -385,7 +386,7 @@
 
44
  */
 
45
 void usage(void)
 
46
 {
 
47
-       fprintf(stderr, "Usage: bootlogd [-v] [-r] [-d] [-p pidfile] [-l logfile]\n");
 
48
+       fprintf(stderr, "Usage: bootlogd [-v] [-r] [-d] [-s] [-c] [-p pidfile] [-l logfile]\n");
 
49
        exit(1);
 
50
 }
 
51
 
 
52
@@ -447,7 +448,7 @@
 
53
        rotate = 0;
 
54
        dontfork = 0;
 
55
 
 
56
-       while ((i = getopt(argc, argv, "dsl:p:rv")) != EOF) switch(i) {
 
57
+       while ((i = getopt(argc, argv, "cdsl:p:rv")) != EOF) switch(i) {
 
58
                case 'l':
 
59
                        logfile = optarg;
 
60
                        break;
 
61
@@ -461,6 +462,9 @@
 
62
                case 'p':
 
63
                        pidfile = optarg;
 
64
                        break;
 
65
+               case 'c':
 
66
+                       createlogfile = 1;
 
67
+                       break;
 
68
                case 'd':
 
69
                        dontfork = 1;
 
70
                        break;
 
71
@@ -613,12 +617,16 @@
 
72
                /*
 
73
                 *      Perhaps we need to open the logfile.
 
74
                 */
 
75
-               if (fp == NULL && rotate && access(logfile, F_OK) == 0) {
 
76
-                       snprintf(buf, sizeof(buf), "%s~", logfile);
 
77
-                       rename(logfile, buf);
 
78
+               if (fp == NULL && access(logfile, F_OK) == 0) {
 
79
+                       if (rotate) {
 
80
+                               snprintf(buf, sizeof(buf), "%s~", logfile);
 
81
+                               rename(logfile, buf);
 
82
+                       }
 
83
+                       fp = fopen(logfile, "a");
 
84
                }
 
85
-               if (fp == NULL)
 
86
+               if (fp == NULL && createlogfile)
 
87
                        fp = fopen(logfile, "a");
 
88
+
 
89
                if (inptr >= outptr)
 
90
                        todo = inptr - outptr;
 
91
                else