-rw-r--r-- | core/launcher/desktop.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 03a23dc..4c239a6 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp @@ -17,8 +17,10 @@ ** not clear to you. ** **********************************************************************/ +#include <syslog.h> + #include "desktop.h" #include "info.h" #include "launcher.h" #include "qcopbridge.h" @@ -737,14 +739,22 @@ void DesktopApplication::shutdown() } void DesktopApplication::shutdown( ShutdownImpl::Type t ) { + + char *opt = 0; + switch ( t ) { case ShutdownImpl::ShutdownSystem: - execlp( "shutdown", "shutdown", "-h", "now", ( void* ) 0 ); - break; + opt = "-h"; + // fall through case ShutdownImpl::RebootSystem: - execlp( "shutdown", "shutdown", "-r", "now", ( void* ) 0 ); + if ( opt == 0 ) + opt = "-r"; + + if ( execle( "shutdown", "shutdown", opt, "now", ( void* ) 0, "/sbin", "/usr/sbin", ( void* ) 0 ) < 0 ) + ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); + break; case ShutdownImpl::RestartDesktop: restart(); break; |