Ticket #9102: proper_shutdown_behavior_for_ubuntu.patch

File proper_shutdown_behavior_for_ubuntu.patch, 1.3 KB (added by superm1@…, 14 years ago)

patch to modify shutdown behavior

  • programs/mythfrontend/exitprompt.cpp

    ## Description: Fixes up the shutdown behavior so users can't break it
    ## Origin/Author: Mario Limonciello
    old new  
    6464{
    6565
    6666    QString halt_cmd = gCoreContext->GetSetting("HaltCommand","");
     67    int ret = -1;
    6768    if (!halt_cmd.isEmpty()) /* Use user specified command if it exists */
    6869    {
    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 */
    7173    {
    7274        myth_system("sudo /sbin/halt -p");
    7375    }
     
    120122{
    121123
    122124    QString reboot_cmd = gCoreContext->GetSetting("RebootCommand","");
     125    int ret = -1;
    123126    if (!reboot_cmd.isEmpty()) /* Use user specified command if it exists */
    124127    {
    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 */
    127131    {
    128132        myth_system("sudo /sbin/reboot");
    129133    }