Skip to content

Commit abf6e0a

Browse files
committed
openrc-run: import variabes from activation environment
1 parent 017fa3a commit abf6e0a

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/openrc-run/openrc-run.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,11 @@ svc_start_deps(void)
709709
tmplist = rc_stringlist_new();
710710
TAILQ_FOREACH(svc, services, entries) {
711711
state = rc_service_state(svc->value);
712-
if (state & RC_SERVICE_STARTED)
712+
if (state & RC_SERVICE_STARTED) {
713+
if (!rc_import_variables(svc->value))
714+
eerror("%s: failed to import variables from %s: %s", applet, svc->value, strerror(errno));
713715
continue;
716+
}
714717

715718
/* Don't wait for services which went inactive but are
716719
* now in starting state which we are after */
@@ -727,8 +730,11 @@ svc_start_deps(void)
727730
eerror("%s: timed out waiting for %s",
728731
applet, svc->value);
729732
state = rc_service_state(svc->value);
730-
if (state & RC_SERVICE_STARTED)
733+
if (state & RC_SERVICE_STARTED) {
734+
if (!rc_import_variables(svc->value))
735+
eerror("%s: failed to import variables from %s: %s", applet, svc->value, strerror(errno));
731736
continue;
737+
}
732738
if (rc_stringlist_find(need_services, svc->value)) {
733739
if (state & RC_SERVICE_INACTIVE ||
734740
state & RC_SERVICE_WASINACTIVE)
@@ -833,6 +839,8 @@ static void svc_start_real(void)
833839
static void
834840
svc_start(void)
835841
{
842+
if (!rc_import_variables(NULL))
843+
eerror("%s: failed to import variables: %s", applet, strerror(errno));
836844
if (dry_run)
837845
einfon("start:");
838846
else
@@ -943,8 +951,9 @@ svc_stop_deps(RC_SERVICE state)
943951
return;
944952

945953
TAILQ_FOREACH(svc, tmplist, entries) {
946-
if (rc_service_state(svc->value) & RC_SERVICE_STOPPED)
954+
if (rc_service_state(svc->value) & RC_SERVICE_STOPPED) {
947955
continue;
956+
}
948957
svc_wait(svc->value);
949958
if (rc_service_state(svc->value) & RC_SERVICE_STOPPED)
950959
continue;
@@ -1015,9 +1024,10 @@ svc_stop_real(void)
10151024
static int
10161025
svc_stop(void)
10171026
{
1018-
RC_SERVICE state;
1027+
RC_SERVICE state = 0;
1028+
1029+
rc_import_variables(NULL);
10191030

1020-
state = 0;
10211031
if (dry_run)
10221032
einfon("stop:");
10231033
else

0 commit comments

Comments
 (0)