~ubuntu-branches/ubuntu/oneiric/insserv/oneiric-proposed

« back to all changes in this revision

Viewing changes to debian/patches/37_consistent_path.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Petter Reinholdtsen
  • Date: 2006-11-02 13:36:10 UTC
  • mfrom: (2.1.1 edgy)
  • Revision ID: james.westby@ubuntu.com-20061102133610-gh6e1y750pwc0id7
Tags: 1.08.0-11
* Add override file for timidity.
* Add override file for powernowd.
* Add override file for laptop-mode.
* Update override file for libnss-ldap.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 37_consistent_path.dpatch by Petter Reinholdtsen <pere@hungry.com>
 
3
 
 
4
Make sure the following invocations of insserv uses the same path to
 
5
init.d/:
 
6
 
 
7
  insserv -nv
 
8
  insserv -nv /etc/init.d
 
9
  insserv -nv /etc/init.d/
 
10
  insserv -nv /etc/init.d/hostname.sh
 
11
 
 
12
Without this patch, they will use '/etc/init.d' and /etc/init.d/'
 
13
respectively, and this produces strange paths in the log output.
 
14
 
 
15
It was sent upstream 2006-09-07.
 
16
 
 
17
@DPATCH@
 
18
--- insserv-1.08.0.orig/insserv.c
 
19
+++ insserv-1.08.0/insserv.c
 
20
@@ -1651,7 +1651,15 @@
 
21
        }
 
22
 
 
23
        if (S_ISDIR(st_script.st_mode)) {
 
24
-           path = *argv;
 
25
+
 
26
+           /* Remove trailing slash from the directory path */
 
27
+           if ('/' == (*argv)[strlen(*argv)-1]) {
 
28
+               char * ptr = xstrdup(*argv);
 
29
+               ptr[strlen(ptr)-1] = '\0';
 
30
+               path = ptr;
 
31
+           } else
 
32
+               path = *argv;
 
33
+
 
34
            if (del)
 
35
                error("usage: %s [[-r] init_script|init_directory]\n", myname);
 
36
            argv++;
 
37
@@ -1662,7 +1670,7 @@
 
38
            char * base, * ptr = xstrdup(*argv);
 
39
 
 
40
            if ((base = strrchr(ptr, '/'))) {
 
41
-               *(++base) = '\0';
 
42
+               *(base) = '\0';
 
43
                path = ptr;
 
44
            } else
 
45
                free(ptr);