summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch')
-rw-r--r--meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch89
1 files changed, 89 insertions, 0 deletions
diff --git a/meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch b/meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch
new file mode 100644
index 0000000000..9b0081307a
--- /dev/null
+++ b/meta/recipes-devtools/insserv/files/40_segfault_virtprov.dpatch
@@ -0,0 +1,89 @@
1#! /bin/sh /usr/share/dpatch/dpatch-run
2## 40_segfault_virtprov.dpatch by Petter Reinholdtsen
3
4Avoid segfault when an enabled service provide a virtual system
5facility.
6
7@DPATCH@
8--- insserv/insserv.c
9+++ insserv/insserv.c 2008-02-01 11:43:45.634618329 +0100
10@@ -166,7 +166,7 @@ typedef struct pwd_struct {
11
12 static list_t pwd = { &(pwd), &(pwd) }, * topd = &(pwd);
13
14-static void pushd(const char *const __restrict path);
15+static void pushd(const char *const __restrict path) __attribute__((nonnull(1)));
16 static void pushd(const char *const path)
17 {
18 pwd_t * dir;
19@@ -305,13 +305,13 @@ out:
20 return getserv(ptr);
21 }
22
23-static serv_t * findserv(const char *const __restrict serv) __attribute__((nonnull(1)));
24+static serv_t * findserv(const char *const __restrict serv);
25 static serv_t * findserv(const char *const serv)
26 {
27 list_t * ptr;
28 serv_t * ret = (serv_t*)0;
29
30- if (!serv)
31+ if (serv == (const char*)0)
32 goto out;
33
34 list_for_each(ptr, serv_start) {
35@@ -334,6 +334,9 @@ static void rememberreq(serv_t *serv, ui
36 list_t * ptr;
37 uint old = bit;
38
39+ if (!tmp)
40+ error("%s", strerror(errno));
41+
42 while ((token = strsep(&tmp, delimeter))) {
43 boolean found = false;
44 req_t * this;
45@@ -399,6 +402,9 @@ static void reversereq(const serv_t * se
46 char * rev = strdupa(list);
47 uint old = bit;
48
49+ if (!rev)
50+ error("%s", strerror(errno));
51+
52 while ((dep = strsep(&rev, delimeter)) && *dep) {
53 serv_t * tmp;
54 list_t * ptr;
55@@ -437,7 +443,7 @@ static void reversereq(const serv_t * se
56 /*
57 * Check required services for name
58 */
59-static boolean chkrequired(const char *const __restrict name) __attribute__((nonnull(1)));
60+static boolean chkrequired(const char *const __restrict name);
61 static boolean chkrequired(const char *const name)
62 {
63 serv_t * serv = findserv(name);
64--- insserv/listing.h
65+++ insserv/listing.h 2008-02-01 11:40:45.347748072 +0100
66@@ -97,11 +97,11 @@ extern int makeprov(const char *__restri
67 extern void setorder(const char *__restrict script, const int order, boolean recursive) __attribute__((nonnull(1)));
68 extern int getorder(const char *__restrict script) __attribute__((nonnull(1)));
69 extern boolean notincluded(const char *__restrict script, const int runlevel) __attribute__((nonnull(1)));
70-extern boolean foreach(const char **__restrict script, int *__restrict order, const int runlevel) __attribute__((nonnull(1,2)));
71-extern void virtprov(const char *__restrict virt, const char *__restrict real) __attribute__((nonnull(1,2)));
72+extern boolean foreach(const char **__restrict script, int *__restrict order, const int runlevel) __attribute__((nonnull(2)));
73+extern void virtprov(const char *__restrict virt, const char *__restrict real) __attribute__((nonnull(1)));
74 extern const char * getscript(const char *__restrict prov) __attribute__((nonnull(1)));
75 extern const char * getprovides(const char *__restrict script) __attribute__((nonnull(1)));
76-extern boolean listscripts(const char **__restrict script, const int lvl) __attribute__((nonnull(1)));
77+extern boolean listscripts(const char **__restrict script, const int lvl);
78 extern int maxorder;
79 extern boolean is_loop_detected(void);
80
81@@ -116,7 +116,7 @@ extern int map_has_runlevels(void);
82 extern int map_runlevel_to_lvl (const int runlevel);
83 extern int map_key_to_lvl(const char key);
84
85-static inline char * xstrdup(const char *__restrict s) __attribute__((always_inline,nonnull(1)));
86+static inline char * xstrdup(const char *__restrict s) __attribute__((always_inline));
87 static inline char * xstrdup(const char * s)
88 {
89 char * r;