>>>>> "David" == David Kuehling <[email protected]> writes:
>>>>> "Xiangfu" == Xiangfu Liu <[email protected]> writes: >> when we run 'ash' 'bash' in gmenu2x it's always give me : /bin/ash : >> can't access tty; job control is turned off when start 'ash' 'bash' >> (http://en.qi-hardware.com/wiki/OpenWrt_Software_Image#Image_2010-12-14 >> see the * KNOWN ISSUES) > Ok, after lots of trial and error, I now have a fix that works. It is > *ugly*, need to clean it up a bit, but anyways: [..] Turns out there is a much more concise fix for the problem: --8<-- int pid = setsid(); tcsetpgrp(1, pid); ioctl(1, TIOCSCTTY, (char *)1); --8<-- A properly formatted and commented patch is attached below (don't have commit access to gmenu2x). cheers, David -- GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg Fingerprint: B17A DC95 D293 657B 4205 D016 7DEF 5323 C174 7D40
diff --git a/src/linkapp.cpp b/src/linkapp.cpp
index 2e3edf6..2cdcd10 100644
--- a/src/linkapp.cpp
+++ b/src/linkapp.cpp
@@ -19,6 +19,7 @@
***************************************************************************/
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include <unistd.h>
#include <fstream>
@@ -492,6 +493,15 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
if((backlight() != 0) && (backlight() != gmenu2x->confInt["backlight"]))
gmenu2x->setBacklight(backlight());
+ /* Make the terminal we're connected to (via stdin/stdout) our
+ contolling terminal again. Else many console programs are
+ not going to work correctly. Actually this would not be
+ necessary, if SDL correctly restored terminal state after
+ SDL_Quit(). */
+ int pid = setsid();
+ tcsetpgrp(1, pid);
+ ioctl(1, TIOCSCTTY, (char *)1);
+
execlp("/bin/sh","/bin/sh","-c",command.c_str(),NULL);
//if execution continues then something went wrong and as we already called SDL_Quit we cannot continue
//try relaunching gmenu2x
pgpS6rt4SitAC.pgp
Description: PGP signature
_______________________________________________ Qi Hardware Discussion List Mail to list (members only): [email protected] Subscribe or Unsubscribe: http://lists.en.qi-hardware.com/mailman/listinfo/discussion

