1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-04 20:52:56 +03:00

Before launching any app, update the standard I/O file descriptors

This commit is contained in:
Paul Cercueil 2012-10-20 17:32:17 +02:00
parent 6a9f429f32
commit d6cdb90c81

View File

@ -561,11 +561,15 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
not going to work correctly. Actually this would not be
necessary, if SDL correctly restored terminal state after
SDL_Quit(). */
pid_t pid = setsid();
if (pid == (pid_t)-1) {
WARNING("Failed to create new process group\n");
}
(void) setsid();
ioctl(1, TIOCSCTTY, STDOUT_FILENO);
(void) dup2(STDOUT_FILENO, 0);
(void) dup2(STDOUT_FILENO, 1);
(void) dup2(STDOUT_FILENO, 2);
if (STDOUT_FILENO > 2)
close(STDOUT_FILENO);
int pgid = tcgetpgrp(STDOUT_FILENO);
signal(SIGTTOU, SIG_IGN);