summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/konsole.cpp
Unidiff
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
@@ -208,28 +208,34 @@ static void konsoleInit(const char** shell) {
208 if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl; 208 if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl;
209 if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges 209 if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges
210 210
211 211
212// QPEApplication::grabKeyboard(); // for CTRL and ALT 212// QPEApplication::grabKeyboard(); // for CTRL and ALT
213 213
214 odebug << "keyboard grabbed" << oendl; 214 odebug << "keyboard grabbed" << oendl;
215#ifdef FAKE_CTRL_AND_ALT 215#ifdef FAKE_CTRL_AND_ALT
216 odebug << "Fake Ctrl and Alt defined" << oendl; 216 odebug << "Fake Ctrl and Alt defined" << oendl;
217 QPEApplication::grabKeyboard(); // for CTRL and ALT 217 QPEApplication::grabKeyboard(); // for CTRL and ALT
218#endif 218#endif
219 219
220 if (!shell) {
221 owarn << "No double pointer 'shell'" << oendl;
222 return;
223 }
224
220 *shell = getenv("SHELL"); 225 *shell = getenv("SHELL");
221 owarn << "SHell initially is " << *shell << "" << oendl; 226 if (*shell)
227 owarn << "Current shell: " << *shell << "" << oendl;
222 228
223 if (shell == NULL || *shell == '\0') { 229 if (*shell == NULL || **shell == '\0') {
224 struct passwd *ent = 0; 230 struct passwd *ent = 0;
225 uid_t me = getuid(); 231 uid_t me = getuid();
226 *shell = "/bin/sh"; 232 *shell = "/bin/sh";
227 233
228 while ( (ent = getpwent()) != 0 ) { 234 while ( (ent = getpwent()) != 0 ) {
229 if (ent->pw_uid == me) { 235 if (ent->pw_uid == me) {
230 if (ent->pw_shell != "") 236 if (ent->pw_shell != "")
231 *shell = ent->pw_shell; 237 *shell = ent->pw_shell;
232 break; 238 break;
233 } 239 }
234 } 240 }
235 endpwent(); 241 endpwent();