Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/system.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings2/system.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp index 85dcd7d..a68f3c0 100644 --- a/noncore/settings/networksettings2/networksettings2/system.cpp +++ b/noncore/settings/networksettings2/networksettings2/system.cpp | |||
@@ -38,14 +38,15 @@ System::~System( void ) { | |||
38 | 38 | ||
39 | int System::execute( const QString & S ) { | 39 | int System::execute( const QString & S ) { |
40 | QString MyS = S; | 40 | QString MyS = S; |
41 | char * usr = getenv("USER"); | ||
41 | int rv; | 42 | int rv; |
42 | 43 | ||
43 | if( S.isEmpty() ) { | 44 | if( S.isEmpty() ) { |
44 | // loophole to start shell | 45 | // loophole to start shell |
45 | return 8888; | 46 | return 8888; |
46 | } | 47 | } |
47 | if( getenv("USER") != "root" ) { | 48 | if( usr == 0 || strcmp( usr, "root" ) ) { |
48 | // use SUDO | 49 | // unknown or non-root user -> use SUDO |
49 | MyS.prepend( "sudo " ); | 50 | MyS.prepend( "sudo " ); |
50 | } | 51 | } |
51 | 52 | ||