1 |
cardoe 08/04/04 19:31:41 |
2 |
|
3 |
Added: openrc-0.2.1-empty-list-crash.patch |
4 |
Removed: openrc-0.2-multilib-fix.patch |
5 |
openrc-0.2-sysctl-vserver-fix.patch |
6 |
openrc-0.2-path-fix-for-multilib-fix.patch |
7 |
openrc-0.2-multiple-ntp-servers.patch |
8 |
openrc-0.2-nicelevel-doc.patch |
9 |
openrc-0.2-freebsd-install-rc.patch |
10 |
Log: |
11 |
fix bug #216091. crash when stringlist was non-existant |
12 |
(Portage version: 2.1.4.4) |
13 |
|
14 |
Revision Changes Path |
15 |
1.1 sys-apps/openrc/files/openrc-0.2.1-empty-list-crash.patch |
16 |
|
17 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/openrc-0.2.1-empty-list-crash.patch?rev=1.1&view=markup |
18 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/openrc-0.2.1-empty-list-crash.patch?rev=1.1&content-type=text/plain |
19 |
|
20 |
Index: openrc-0.2.1-empty-list-crash.patch |
21 |
=================================================================== |
22 |
diff --git a/src/rc/runscript.c b/src/rc/runscript.c |
23 |
index 421f432..aa4a602 100644 |
24 |
--- a/src/rc/runscript.c |
25 |
+++ b/src/rc/runscript.c |
26 |
@@ -648,6 +648,19 @@ static void setup_types(void) |
27 |
rc_stringlist_add(types_mua, "beforeme"); |
28 |
} |
29 |
|
30 |
+static bool in_list(RC_STRINGLIST *list, char *string) |
31 |
+{ |
32 |
+ RC_STRING *s; |
33 |
+ |
34 |
+ if (! list) |
35 |
+ return false; |
36 |
+ TAILQ_FOREACH(s, list, entries) |
37 |
+ if (strcmp(s->value, string) == 0) |
38 |
+ return true; |
39 |
+ return false; |
40 |
+} |
41 |
+ |
42 |
+ |
43 |
static void svc_start(bool deps) |
44 |
{ |
45 |
bool started; |
46 |
@@ -747,35 +760,29 @@ static void svc_start(bool deps) |
47 |
/* Don't wait for services which went inactive but are now in |
48 |
* starting state which we are after */ |
49 |
if (svcs & RC_SERVICE_STARTING && |
50 |
- svcs & RC_SERVICE_WASINACTIVE) { |
51 |
- TAILQ_FOREACH(svc2, use_services, entries) { |
52 |
- if (strcmp (svc->value, svc2->value) == 0) |
53 |
- break; |
54 |
- } |
55 |
- if (! svc2) |
56 |
+ svcs & RC_SERVICE_WASINACTIVE) |
57 |
+ { |
58 |
+ if (!in_list(need_services, svc->value) && |
59 |
+ !in_list(use_services, svc->value)) |
60 |
continue; |
61 |
} |
62 |
|
63 |
if (! svc_wait(svc->value)) |
64 |
eerror ("%s: timed out waiting for %s", |
65 |
applet, svc->value); |
66 |
- if (! need_services) |
67 |
- continue; |
68 |
if ((svcs = rc_service_state(svc->value)) & RC_SERVICE_STARTED) |
69 |
continue; |
70 |
- TAILQ_FOREACH(svc2, need_services, entries) { |
71 |
- if (strcmp (svc->value, svc2->value) == 0) { |
72 |
- if (svcs & RC_SERVICE_INACTIVE || |
73 |
- svcs & RC_SERVICE_WASINACTIVE) |
74 |
- { |
75 |
- if (! tmplist) |
76 |
- tmplist = rc_stringlist_new(); |
77 |
- rc_stringlist_add(tmplist, svc->value); |
78 |
- } else |
79 |
- eerrorx("ERROR: cannot start %s as" |
80 |
- " %s would not start", |
81 |
- applet, svc->value); |
82 |
- } |
83 |
+ if (in_list(need_services, svc->value)) { |
84 |
+ if (svcs & RC_SERVICE_INACTIVE || |
85 |
+ svcs & RC_SERVICE_WASINACTIVE) |
86 |
+ { |
87 |
+ if (! tmplist) |
88 |
+ tmplist = rc_stringlist_new(); |
89 |
+ rc_stringlist_add(tmplist, svc->value); |
90 |
+ } else |
91 |
+ eerrorx("ERROR: cannot start %s as" |
92 |
+ " %s would not start", |
93 |
+ applet, svc->value); |
94 |
} |
95 |
} |
96 |
|
97 |
@@ -932,12 +939,12 @@ static void svc_stop(bool deps) |
98 |
TAILQ_FOREACH_REVERSE(svc, services, rc_stringlist, entries) { |
99 |
RC_SERVICE svcs = rc_service_state(svc->value); |
100 |
if (svcs & RC_SERVICE_STARTED || |
101 |
- svcs & RC_SERVICE_INACTIVE) |
102 |
+ svcs & RC_SERVICE_INACTIVE) |
103 |
{ |
104 |
svc_wait(svc->value); |
105 |
svcs = rc_service_state(svc->value); |
106 |
if (svcs & RC_SERVICE_STARTED || |
107 |
- svcs & RC_SERVICE_INACTIVE) |
108 |
+ svcs & RC_SERVICE_INACTIVE) |
109 |
{ |
110 |
pid_t pid = service_stop(svc->value); |
111 |
if (! rc_conf_yesno("rc_parallel")) |
112 |
@@ -964,9 +971,9 @@ static void svc_stop(bool deps) |
113 |
/* If shutting down, we should stop even |
114 |
* if a dependant failed */ |
115 |
if (runlevel && |
116 |
- (strcmp(runlevel, RC_LEVEL_SHUTDOWN) == 0 || |
117 |
- strcmp(runlevel, RC_LEVEL_REBOOT) == 0 || |
118 |
- strcmp(runlevel, RC_LEVEL_SINGLE) == 0)) |
119 |
+ (strcmp(runlevel, RC_LEVEL_SHUTDOWN) == 0 || |
120 |
+ strcmp(runlevel, RC_LEVEL_REBOOT) == 0 || |
121 |
+ strcmp(runlevel, RC_LEVEL_SINGLE) == 0)) |
122 |
continue; |
123 |
rc_service_mark(service, RC_SERVICE_FAILED); |
124 |
} |
125 |
|
126 |
|
127 |
|
128 |
-- |
129 |
gentoo-commits@l.g.o mailing list |