summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-24 21:36:29 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-17 14:35:35 +0200
commit6176e89c2072a3687d358ab104b7c9c5066aeadc (patch)
treeff861d9219a6cce0b65633b94c03883e378e0408 /src/systemctl
parent043fdc40105f976fc4884dbe95345d1cf05f5c64 (diff)
downloadsystemd-6176e89c2072a3687d358ab104b7c9c5066aeadc.tar.gz
systemctl: call the unit dbus path dbus_path everywhere
Similar variables had differing names: unit, path, unit_path. We also have file system paths in surrounding code. Let's make this easier for the reader and use "dbus_path" consistently.
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 019655e4a1..97f3176cc5 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1639,20 +1639,20 @@ static int list_dependencies_get_dependencies(sd_bus *bus, const char *name, cha
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_strv_free_ char **ret = NULL;
- _cleanup_free_ char *path = NULL;
+ _cleanup_free_ char *dbus_path = NULL;
int i, r;
assert(bus);
assert(name);
assert(deps);
- path = unit_dbus_path_from_name(name);
- if (!path)
+ dbus_path = unit_dbus_path_from_name(name);
+ if (!dbus_path)
return log_oom();
r = bus_map_all_properties(bus,
"org.freedesktop.systemd1",
- path,
+ dbus_path,
map[arg_dependency],
BUS_MAP_STRDUP,
&error,
@@ -2532,16 +2532,16 @@ static int unit_find_paths(
!install_client_side() &&
!unit_name_is_valid(unit_name, UNIT_NAME_TEMPLATE)) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_free_ char *load_state = NULL, *unit = NULL;
+ _cleanup_free_ char *load_state = NULL, *dbus_path = NULL;
- unit = unit_dbus_path_from_name(unit_name);
- if (!unit)
+ dbus_path = unit_dbus_path_from_name(unit_name);
+ if (!dbus_path)
return log_oom();
r = sd_bus_get_property_string(
bus,
"org.freedesktop.systemd1",
- unit,
+ dbus_path,
"org.freedesktop.systemd1.Unit",
"LoadState",
&error,
@@ -2561,7 +2561,7 @@ static int unit_find_paths(
r = sd_bus_get_property_string(
bus,
"org.freedesktop.systemd1",
- unit,
+ dbus_path,
"org.freedesktop.systemd1.Unit",
"FragmentPath",
&error,
@@ -2573,7 +2573,7 @@ static int unit_find_paths(
r = sd_bus_get_property_strv(
bus,
"org.freedesktop.systemd1",
- unit,
+ dbus_path,
"org.freedesktop.systemd1.Unit",
"DropInPaths",
&error,
@@ -2624,13 +2624,13 @@ static int unit_find_paths(
}
}
+ if (isempty(path)) {
+ *ret_fragment_path = NULL;
r = 0;
-
- if (!isempty(path)) {
+ } else {
*ret_fragment_path = TAKE_PTR(path);
r = 1;
- } else
- *ret_fragment_path = NULL;
+ }
if (ret_dropin_paths) {
if (!strv_isempty(dropins)) {
@@ -2649,21 +2649,21 @@ static int unit_find_paths(
static int get_state_one_unit(sd_bus *bus, const char *name, UnitActiveState *active_state) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_free_ char *buf = NULL, *path = NULL;
+ _cleanup_free_ char *buf = NULL, *dbus_path = NULL;
UnitActiveState state;
int r;
assert(name);
assert(active_state);
- path = unit_dbus_path_from_name(name);
- if (!path)
+ dbus_path = unit_dbus_path_from_name(name);
+ if (!dbus_path)
return log_oom();
r = sd_bus_get_property_string(
bus,
"org.freedesktop.systemd1",
- path,
+ dbus_path,
"org.freedesktop.systemd1.Unit",
"ActiveState",
&error,
@@ -2706,7 +2706,7 @@ static int unit_is_masked(sd_bus *bus, LookupPaths *lp, const char *name) {
static int check_triggering_units(sd_bus *bus, const char *name) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- _cleanup_free_ char *n = NULL, *path = NULL, *load_state = NULL;
+ _cleanup_free_ char *n = NULL, *dbus_path = NULL, *load_state = NULL;
_cleanup_strv_free_ char **triggered_by = NULL;
bool print_warning_label = true;
UnitActiveState active_state;
@@ -2724,14 +2724,14 @@ static int check_triggering_units(sd_bus *bus, const char *name) {
if (streq(load_state, "masked"))
return 0;
- path = unit_dbus_path_from_name(n);
- if (!path)
+ dbus_path = unit_dbus_path_from_name(n);
+ if (!dbus_path)
return log_oom();
r = sd_bus_get_property_strv(
bus,
"org.freedesktop.systemd1",
- path,
+ dbus_path,
"org.freedesktop.systemd1.Unit",
"TriggeredBy",
&error,