Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 216091
Collapse All | Expand All

(-)a/src/rc/runscript.c (-26 / +33 lines)
Lines 648-653 static void setup_types(void) Link Here
648
	rc_stringlist_add(types_mua, "beforeme");
648
	rc_stringlist_add(types_mua, "beforeme");
649
}
649
}
650
650
651
static bool in_list(RC_STRINGLIST *list, char *string)
652
{
653
	RC_STRING *s;
654
655
	if (! list)
656
		return false;
657
	TAILQ_FOREACH(s, list, entries)
658
		if (strcmp(s->value, string) == 0)
659
			return true;
660
	return false;
661
}
662
663
651
static void svc_start(bool deps)
664
static void svc_start(bool deps)
652
{
665
{
653
	bool started;
666
	bool started;
Lines 747-781 static void svc_start(bool deps) Link Here
747
				/* Don't wait for services which went inactive but are now in
760
				/* Don't wait for services which went inactive but are now in
748
				 * starting state which we are after */
761
				 * starting state which we are after */
749
				if (svcs & RC_SERVICE_STARTING &&
762
				if (svcs & RC_SERVICE_STARTING &&
750
						svcs & RC_SERVICE_WASINACTIVE) {
763
				    svcs & RC_SERVICE_WASINACTIVE)
751
					TAILQ_FOREACH(svc2, use_services, entries) {
764
				{
752
						if (strcmp (svc->value, svc2->value) == 0) 
765
					if (!in_list(need_services, svc->value) &&
753
							break;
766
					    !in_list(use_services, svc->value))
754
					}
755
					if (! svc2)
756
						continue;
767
						continue;
757
				}
768
				}
758
769
759
				if (! svc_wait(svc->value))
770
				if (! svc_wait(svc->value))
760
					eerror ("%s: timed out waiting for %s",
771
					eerror ("%s: timed out waiting for %s",
761
							applet, svc->value);
772
							applet, svc->value);
762
				if (! need_services)
763
					continue;
764
				if ((svcs = rc_service_state(svc->value)) & RC_SERVICE_STARTED)
773
				if ((svcs = rc_service_state(svc->value)) & RC_SERVICE_STARTED)
765
					continue;
774
					continue;
766
				TAILQ_FOREACH(svc2, need_services, entries) {
775
				if (in_list(need_services, svc->value)) {
767
					if (strcmp (svc->value, svc2->value) == 0) {
776
					if (svcs & RC_SERVICE_INACTIVE ||
768
						if (svcs & RC_SERVICE_INACTIVE ||
777
					    svcs & RC_SERVICE_WASINACTIVE)
769
								svcs & RC_SERVICE_WASINACTIVE)
778
					{
770
						{
779
						if (! tmplist)
771
							if (! tmplist)
780
							tmplist = rc_stringlist_new();
772
								tmplist = rc_stringlist_new();
781
						rc_stringlist_add(tmplist, svc->value);
773
							rc_stringlist_add(tmplist, svc->value);
782
					} else
774
						} else
783
						eerrorx("ERROR: cannot start %s as"
775
							eerrorx("ERROR: cannot start %s as"
784
							" %s would not start",
776
									" %s would not start",
785
							applet, svc->value);
777
									applet, svc->value);
778
					}
779
				}
786
				}
780
			}
787
			}
781
788
Lines 932-943 static void svc_stop(bool deps) Link Here
932
			TAILQ_FOREACH_REVERSE(svc, services, rc_stringlist, entries) {
939
			TAILQ_FOREACH_REVERSE(svc, services, rc_stringlist, entries) {
933
				RC_SERVICE svcs = rc_service_state(svc->value);
940
				RC_SERVICE svcs = rc_service_state(svc->value);
934
				if (svcs & RC_SERVICE_STARTED ||
941
				if (svcs & RC_SERVICE_STARTED ||
935
						svcs & RC_SERVICE_INACTIVE)
942
				    svcs & RC_SERVICE_INACTIVE)
936
				{
943
				{
937
					svc_wait(svc->value);
944
					svc_wait(svc->value);
938
					svcs = rc_service_state(svc->value);
945
					svcs = rc_service_state(svc->value);
939
					if (svcs & RC_SERVICE_STARTED ||
946
					if (svcs & RC_SERVICE_STARTED ||
940
							svcs & RC_SERVICE_INACTIVE)
947
					    svcs & RC_SERVICE_INACTIVE)
941
					{
948
					{
942
						pid_t pid = service_stop(svc->value);
949
						pid_t pid = service_stop(svc->value);
943
						if (! rc_conf_yesno("rc_parallel"))
950
						if (! rc_conf_yesno("rc_parallel"))
Lines 964-972 static void svc_stop(bool deps) Link Here
964
						/* If shutting down, we should stop even
971
						/* If shutting down, we should stop even
965
						 * if a dependant failed */
972
						 * if a dependant failed */
966
						if (runlevel &&
973
						if (runlevel &&
967
								(strcmp(runlevel, RC_LEVEL_SHUTDOWN) == 0 ||
974
						    (strcmp(runlevel, RC_LEVEL_SHUTDOWN) == 0 ||
968
								 strcmp(runlevel, RC_LEVEL_REBOOT) == 0 ||
975
						     strcmp(runlevel, RC_LEVEL_REBOOT) == 0 ||
969
								 strcmp(runlevel, RC_LEVEL_SINGLE) == 0))
976
						     strcmp(runlevel, RC_LEVEL_SINGLE) == 0))
970
							continue;
977
							continue;
971
						rc_service_mark(service, RC_SERVICE_FAILED);
978
						rc_service_mark(service, RC_SERVICE_FAILED);
972
					}
979
					}

Return to bug 216091