Date: | 2011-10-23 13:03:11 (12 years 5 months ago) |
---|---|
Author: | Maarten ter Huurne |
Commit: | 14bae043c08c3c3776bed11065f058757d3563f4 |
Message: | LinkApp: various cleanups. Log a warning message if setsid() fails. Also improved code layout. |
Files: |
src/linkapp.cpp (1 diff) |
Change Details
src/linkapp.cpp | ||
---|---|---|
458 | 458 | if (dontleave) { |
459 | 459 | system(command.c_str()); |
460 | 460 | } else { |
461 | if (gmenu2x->confInt["saveSelection"] && (gmenu2x->confInt["section"]!=gmenu2x->menu->selSectionIndex() || gmenu2x->confInt["link"]!=gmenu2x->menu->selLinkIndex())) | |
461 | if (gmenu2x->confInt["saveSelection"] && ( | |
462 | gmenu2x->confInt["section"]!=gmenu2x->menu->selSectionIndex() | |
463 | || gmenu2x->confInt["link"]!=gmenu2x->menu->selLinkIndex() | |
464 | )) { | |
462 | 465 | gmenu2x->writeConfig(); |
466 | } | |
463 | 467 | |
464 | 468 | #ifdef PLATFORM_GP2X |
465 | if (gmenu2x->fwType == "open2x" && gmenu2x->savedVolumeMode != gmenu2x->volumeMode) | |
469 | if (gmenu2x->fwType == "open2x" | |
470 | && gmenu2x->savedVolumeMode != gmenu2x->volumeMode) { | |
466 | 471 | gmenu2x->writeConfigOpen2x(); |
472 | } | |
467 | 473 | #endif |
468 | 474 | |
469 | if (selectedFile=="") | |
475 | if (selectedFile == "") { | |
470 | 476 | gmenu2x->writeTmp(); |
471 | gmenu2x->quit(); | |
472 | if (clock()!=gmenu2x->confInt["menuClock"]) | |
477 | } | |
478 | if (clock() != gmenu2x->confInt["menuClock"]) { | |
473 | 479 | gmenu2x->setClock(clock()); |
480 | } | |
481 | gmenu2x->quit(); | |
474 | 482 | //if (gamma()!=0 && gamma()!=gmenu2x->confInt["gamma"]) |
475 | 483 | // gmenu2x->setGamma(gamma()); |
476 | 484 | |
477 | 485 | /* Make the terminal we're connected to (via stdin/stdout) our |
478 | contolling terminal again. Else many console programs are | |
479 | not going to work correctly. Actually this would not be | |
480 | necessary, if SDL correctly restored terminal state after | |
481 | SDL_Quit(). */ | |
482 | int pid = setsid(); | |
486 | controlling terminal again. Else many console programs are | |
487 | not going to work correctly. Actually this would not be | |
488 | necessary, if SDL correctly restored terminal state after | |
489 | SDL_Quit(). */ | |
490 | pid_t pid = setsid(); | |
491 | if (pid == (pid_t)-1) { | |
492 | WARNING("Failed to create new process group\n"); | |
493 | } | |
483 | 494 | ioctl(1, TIOCSCTTY, STDOUT_FILENO); |
484 | 495 | |
485 | 496 | int pgid = tcgetpgrp(STDOUT_FILENO); |
486 | 497 | signal(SIGTTOU, SIG_IGN); |
487 | 498 | tcsetpgrp(STDOUT_FILENO, pgid); |
488 | 499 | |
489 | execlp("/bin/sh","/bin/sh","-c",command.c_str(),NULL); | |
500 | execlp("/bin/sh","/bin/sh", "-c", command.c_str(), NULL); | |
490 | 501 | //if execution continues then something went wrong and as we already called SDL_Quit we cannot continue |
491 | 502 | //try relaunching gmenu2x |
492 | 503 | chdir(gmenu2x->getExePath().c_str()); |
493 | 504 | execlp("./gmenu2x", "./gmenu2x", NULL); |
494 | 505 | } |
495 | 506 | |
496 | ||
497 | 507 | chdir(gmenu2x->getExePath().c_str()); |
498 | 508 | } |
499 | 509 |
Branches:
install_locations
master
opkrun
packages