- /* If the actual operation is inhibited, warn and fail */
- if (!ignore_inhibited &&
- manager_is_inhibited(b->manager, inhibit_operation, INHIBIT_BLOCK, NULL, false, false, 0)) {
-
-
- /* If this is just a recheck of the lid switch then don't warn about anything */
- if (!is_edge) {
- log_debug("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_operation));
- return 0;
- }
-
- log_error("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_operation));
- warn_melody();
- return -EPERM;
- }
-
- log_info("%s", message_table[handle]);
-
- /* We are executing the operation, so make sure we don't
- * execute another one until the lid is opened/closed again */
- b->lid_close_queued = false;
-
- dbus_error_init(&error);
- r = bus_manager_shutdown_or_sleep_now_or_later(b->manager, target_table[handle], inhibit_operation, &error);
- if (r < 0) {
- log_error("Failed to execute operation: %s", bus_error_message(&error));
- dbus_error_free(&error);
- return r;
- }
-
- return 1;