Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 10 |
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[] = | |||
196 | "touch", | 196 | "touch", |
197 | "umount", | 197 | "umount", |
198 | "mknod", | 198 | "mknod", |
199 | "netstat", | 199 | "netstat", |
200 | */ | 200 | */ |
201 | 201 | ||
202 | "exit", | 202 | "exit", |
203 | NULL | 203 | NULL |
204 | }; | 204 | }; |
205 | 205 | ||
206 | 206 | ||
207 | static void konsoleInit(const char** shell) { | 207 | 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(); |
236 | } | 242 | } |
237 | 243 | ||
238 | if( putenv((char*)"COLORTERM=") !=0) | 244 | if( putenv((char*)"COLORTERM=") !=0) |
239 | odebug << "putenv failed" << oendl; // to trigger mc's color detection | 245 | odebug << "putenv failed" << oendl; // to trigger mc's color detection |
240 | } | 246 | } |
241 | 247 | ||
242 | 248 | ||
243 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 249 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
244 | QMainWindow(parent, name, fl) | 250 | QMainWindow(parent, name, fl) |
245 | { | 251 | { |
246 | QStrList tmp; const char* shell; | 252 | QStrList tmp; const char* shell; |
247 | 253 | ||