Skip to content

Commit

Permalink
systemctl: Don't give re-activation warning if unit is masked
Browse files Browse the repository at this point in the history
  • Loading branch information
medhefgo authored and keszybz committed Feb 16, 2013
1 parent 265a7a2 commit d0a5cdb
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion src/systemctl/systemctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,9 @@ static void check_triggering_units(
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
DBusMessageIter iter, sub;
const char *interface = "org.freedesktop.systemd1.Unit",
*triggered_by_property = "TriggeredBy";
*load_state_property = "LoadState",
*triggered_by_property = "TriggeredBy",
*state;
char _cleanup_free_ *unit_path = NULL, *n = NULL;
bool print_warning_label = true;
int r;
Expand All @@ -1353,6 +1355,41 @@ static void check_triggering_units(
return;
}

r = bus_method_call_with_reply(
bus,
"org.freedesktop.systemd1",
unit_path,
"org.freedesktop.DBus.Properties",
"Get",
&reply,
NULL,
DBUS_TYPE_STRING, &interface,
DBUS_TYPE_STRING, &load_state_property,
DBUS_TYPE_INVALID);
if (r < 0)
return;

if (!dbus_message_iter_init(reply, &iter) ||
dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) {
log_error("Failed to parse reply.");
return;
}

dbus_message_iter_recurse(&iter, &sub);

if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING) {
log_error("Failed to parse reply.");
return;
}

dbus_message_iter_get_basic(&sub, &state);

if (streq(state, "masked"))
return;

dbus_message_unref(reply);
reply = NULL;

r = bus_method_call_with_reply(
bus,
"org.freedesktop.systemd1",
Expand Down

0 comments on commit d0a5cdb

Please sign in to comment.