Replace the conditions of some ifs that make no difference now but are
the correct behavior if session mode is added
---
 src/core/dbus.c           | 2 +-
 src/core/main.c           | 4 ++--
 src/core/manager.c        | 2 +-
 src/core/service.c        | 2 +-
 src/core/unit.c           | 2 +-
 src/shared/path-lookup.c  | 2 +-
 src/systemctl/systemctl.c | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/core/dbus.c b/src/core/dbus.c
index 7d7c6cb..ef9a64b 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -969,7 +969,7 @@ static int bus_init_private(Manager *m) {
 
                 strcpy(sa.un.sun_path, "/run/systemd/private");
                 salen = offsetof(union sockaddr_union, un.sun_path) + 
sizeof("/run/systemd/private") - 1;
-        } else {
+        } else if (m->running_as == SYSTEMD_USER) {
                 size_t left = sizeof(sa.un.sun_path);
                 char *p = sa.un.sun_path;
                 const char *e;
diff --git a/src/core/main.c b/src/core/main.c
index 6c3d9bf..ce5b64c 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1392,7 +1392,7 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
-        if (arg_running_as == SYSTEMD_USER &&
+        if (arg_running_as != SYSTEMD_SYSTEM &&
             arg_action == ACTION_RUN &&
             sd_booted() <= 0) {
                 log_error("Trying to run as user instance, but the system has 
not been booted with systemd.");
@@ -1519,7 +1519,7 @@ int main(int argc, char *argv[]) {
                 }
         }
 
-        if (arg_running_as == SYSTEMD_USER) {
+        if (arg_running_as != SYSTEMD_SYSTEM) {
                 /* Become reaper of our children */
                 if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) {
                         log_warning("Failed to make us a subreaper: %m");
diff --git a/src/core/manager.c b/src/core/manager.c
index badf19e..ada62d0 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1597,7 +1597,7 @@ static int manager_dispatch_signal_fd(sd_event_source 
*source, int fd, uint32_t
                                 break;
 
                         case 24:
-                                if (m->running_as == SYSTEMD_USER) {
+                                if (m->running_as != SYSTEMD_SYSTEM) {
                                         m->exit_code = MANAGER_EXIT;
                                         return 0;
                                 }
diff --git a/src/core/service.c b/src/core/service.c
index fcfeda7..76de567 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1145,7 +1145,7 @@ static int service_add_default_dependencies(Service *s) {
                 if (r < 0)
                         return r;
 
-        } else if (UNIT(s)->manager->running_as == SYSTEMD_USER) {
+        } else {
                 r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, 
UNIT_REQUIRES,
                                                       SPECIAL_SOCKETS_TARGET, 
NULL, true);
                 if (r < 0)
diff --git a/src/core/unit.c b/src/core/unit.c
index 31d5f11..69e701c 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2653,7 +2653,7 @@ int unit_exec_context_defaults(Unit *u, ExecContext *c) {
                                 return -ENOMEM;
                 }
 
-        if (u->manager->running_as == SYSTEMD_USER &&
+        if (u->manager->running_as != SYSTEMD_SYSTEM &&
             !c->working_directory) {
 
                 r = get_home_dir(&c->working_directory);
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 1a47ea9..be605ca 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -293,7 +293,7 @@ int lookup_paths_init(
                         if (!p->unit_path)
                                 return -ENOMEM;
 
-                } else {
+                } else if (running_as == SYSTEMD_SYSTEM) {
                         p->unit_path = strv_new(
                                         /* If you modify this you also want to 
modify
                                          * systemdsystemunitpath= in 
systemd.pc.in! */
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index a6f95d6..edc3cb6 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -6155,7 +6155,7 @@ int main(int argc, char*argv[]) {
         }
 
         if (!avoid_bus())
-                r = bus_open_transport_systemd(arg_transport, arg_host, 
arg_scope != UNIT_FILE_SYSTEM, &bus);
+                r = bus_open_transport_systemd(arg_transport, arg_host, 
arg_as, &bus);
 
         /* systemctl_main() will print an error message for the bus
          * connection, but only if it needs to */
-- 
1.8.4.4

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to