chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
687aa1e
)
Prep v231.2: loginctl: Move check for cancelling a scheduled shutdown to allow extra...
author
Sven Eden
<yamakuzure@gmx.net>
Mon, 26 Jun 2017 06:03:24 +0000
(08:03 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Mon, 26 Jun 2017 06:03:24 +0000
(08:03 +0200)
src/login/eloginctl.c
patch
|
blob
|
history
diff --git
a/src/login/eloginctl.c
b/src/login/eloginctl.c
index 9e40e87ad22ffe12ac5a9069b6ed5a21fabf86d8..f86109dc274e6668def0b1958697e1fbbdfd0efa 100644
(file)
--- a/
src/login/eloginctl.c
+++ b/
src/login/eloginctl.c
@@
-196,6
+196,7
@@
void elogind_cleanup(void) {
}
static void elogind_log_special(enum elogind_action a) {
}
static void elogind_log_special(enum elogind_action a) {
+#ifdef ENABLE_DEBUG_ELOGIND
switch (a) {
case ACTION_HALT:
log_struct(LOG_INFO,
switch (a) {
case ACTION_HALT:
log_struct(LOG_INFO,
@@
-246,6
+247,7
@@
static void elogind_log_special(enum elogind_action a) {
default:
break;
}
default:
break;
}
+#endif // ENABLE_DEBUG_ELOGIND
}
static int elogind_reboot(sd_bus *bus, enum elogind_action a) {
}
static int elogind_reboot(sd_bus *bus, enum elogind_action a) {
@@
-260,8
+262,6
@@
static int elogind_reboot(sd_bus *bus, enum elogind_action a) {
if (!bus)
return -EIO;
if (!bus)
return -EIO;
- polkit_agent_open_if_enabled();
-
switch (a) {
case ACTION_POWEROFF:
switch (a) {
case ACTION_POWEROFF:
@@
-288,6
+288,7
@@
static int elogind_reboot(sd_bus *bus, enum elogind_action a) {
return -EINVAL;
}
return -EINVAL;
}
+ polkit_agent_open_if_enabled();
r = elogind_set_wall_message(bus, table[a]);
if (r < 0) {
r = elogind_set_wall_message(bus, table[a]);
if (r < 0) {
@@
-305,8
+306,7
@@
static int elogind_reboot(sd_bus *bus, enum elogind_action a) {
method,
&error,
NULL,
method,
&error,
NULL,
- "b",
- arg_ask_password);
+ "b", arg_ask_password);
if (r < 0)
log_error("Failed to execute operation: %s", bus_error_message(&error, r));
if (r < 0)
log_error("Failed to execute operation: %s", bus_error_message(&error, r));
@@
-322,8
+322,6
@@
static int elogind_schedule_shutdown(sd_bus *bus, enum elogind_action a) {
if (!bus)
return -EIO;
if (!bus)
return -EIO;
- polkit_agent_open_if_enabled();
-
switch (a) {
case ACTION_POWEROFF:
switch (a) {
case ACTION_POWEROFF:
@@
-468,20
+466,9
@@
int start_special(int argc, char *argv[], void *userdata) {
elogind_log_special(a);
elogind_log_special(a);
- /* Switch to cancel shutdown, if a shutdown action was requested,
- and the option to cancel it was set: */
- if ( IN_SET(a, ACTION_POWEROFF, ACTION_REBOOT)
- && (arg_action == ACTION_CANCEL_SHUTDOWN) )
- return elogind_cancel_shutdown(bus);
-
- r = check_inhibitors(bus, a);
- if (r < 0)
- return r;
-
/* No power off actions in chroot environments */
/* No power off actions in chroot environments */
- if ((a == ACTION_POWEROFF ||
- a == ACTION_REBOOT) &&
- (running_in_chroot() > 0) ) {
+ if ( IN_SET(a, ACTION_POWEROFF, ACTION_REBOOT)
+ && (running_in_chroot() > 0) ) {
log_info("Running in chroot, ignoring request.");
return 0;
}
log_info("Running in chroot, ignoring request.");
return 0;
}
@@
-512,6
+499,16
@@
int start_special(int argc, char *argv[], void *userdata) {
return log_oom();
}
return log_oom();
}
+ /* Switch to cancel shutdown, if a shutdown action was requested,
+ and the option to cancel it was set: */
+ if ( IN_SET(a, ACTION_POWEROFF, ACTION_REBOOT)
+ && (arg_action == ACTION_CANCEL_SHUTDOWN) )
+ return elogind_cancel_shutdown(bus);
+
+ r = check_inhibitors(bus, a);
+ if (r < 0)
+ return r;
+
/* Perform requested action */
if (IN_SET(a,
ACTION_POWEROFF,
/* Perform requested action */
if (IN_SET(a,
ACTION_POWEROFF,