summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/konsole.cpp
Side-by-side diff
Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index f4ca0bf..5c40569 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -196,52 +196,58 @@ static const char *commonCmds[] =
"touch",
"umount",
"mknod",
"netstat",
*/
"exit",
NULL
};
static void konsoleInit(const char** shell) {
if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl;
if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges
// QPEApplication::grabKeyboard(); // for CTRL and ALT
odebug << "keyboard grabbed" << oendl;
#ifdef FAKE_CTRL_AND_ALT
odebug << "Fake Ctrl and Alt defined" << oendl;
QPEApplication::grabKeyboard(); // for CTRL and ALT
#endif
+ if (!shell) {
+ owarn << "No double pointer 'shell'" << oendl;
+ return;
+ }
+
*shell = getenv("SHELL");
- owarn << "SHell initially is " << *shell << "" << oendl;
+ if (*shell)
+ owarn << "Current shell: " << *shell << "" << oendl;
- if (shell == NULL || *shell == '\0') {
+ if (*shell == NULL || **shell == '\0') {
struct passwd *ent = 0;
uid_t me = getuid();
*shell = "/bin/sh";
while ( (ent = getpwent()) != 0 ) {
if (ent->pw_uid == me) {
if (ent->pw_shell != "")
*shell = ent->pw_shell;
break;
}
}
endpwent();
}
if( putenv((char*)"COLORTERM=") !=0)
odebug << "putenv failed" << oendl; // to trigger mc's color detection
}
Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
QMainWindow(parent, name, fl)
{
QStrList tmp; const char* shell;