## Description: Fixes up the shutdown behavior so users can't break it
## Origin/Author: Mario Limonciello
old
|
new
|
|
64 | 64 | { |
65 | 65 | |
66 | 66 | QString halt_cmd = gCoreContext->GetSetting("HaltCommand",""); |
| 67 | int ret = -1; |
67 | 68 | if (!halt_cmd.isEmpty()) /* Use user specified command if it exists */ |
68 | 69 | { |
69 | | myth_system(halt_cmd); |
70 | | } else if (!DBusHalt()) /* If supported, use DBus to shutdown */ |
| 70 | ret = myth_system(halt_cmd); |
| 71 | } |
| 72 | if (ret != 0 && !DBusHalt()) /* If supported, use DBus to shutdown */ |
71 | 73 | { |
72 | 74 | myth_system("sudo /sbin/halt -p"); |
73 | 75 | } |
… |
… |
|
120 | 122 | { |
121 | 123 | |
122 | 124 | QString reboot_cmd = gCoreContext->GetSetting("RebootCommand",""); |
| 125 | int ret = -1; |
123 | 126 | if (!reboot_cmd.isEmpty()) /* Use user specified command if it exists */ |
124 | 127 | { |
125 | | myth_system(reboot_cmd); |
126 | | } else if (!DBusReboot()) /* If supported, use DBus to reboot */ |
| 128 | ret = myth_system(reboot_cmd); |
| 129 | } |
| 130 | if (ret != 0 && !DBusReboot()) /* If supported, use DBus to reboot */ |
127 | 131 | { |
128 | 132 | myth_system("sudo /sbin/reboot"); |
129 | 133 | } |