mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-03 02:41:12 +02:00
yaft: reset signal handler after terminal exit
Origin commit data
------------------
Branch: ni/coolstream
Commit: a926d2f380
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2018-02-18 (Sun, 18 Feb 2018)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
committed by
vanhofen
parent
65020037f4
commit
0ef1e6d237
@@ -124,7 +124,7 @@ int YaFT::run(void)
|
|||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
bool need_redraw = false;
|
bool need_redraw = false;
|
||||||
exitcode = 0;
|
exitcode = EXIT_FAILURE;
|
||||||
YaFT_p *term = new YaFT_p(paint);
|
YaFT_p *term = new YaFT_p(paint);
|
||||||
int flags;
|
int flags;
|
||||||
/* init */
|
/* init */
|
||||||
@@ -133,17 +133,19 @@ int YaFT::run(void)
|
|||||||
if (!term->init())
|
if (!term->init())
|
||||||
goto init_failed;
|
goto init_failed;
|
||||||
|
|
||||||
struct sigaction sigact;
|
struct sigaction sigact, oldact;
|
||||||
memset(&sigact, 0, sizeof(struct sigaction));
|
memset(&sigact, 0, sizeof(struct sigaction));
|
||||||
|
memset(&oldact, 0, sizeof(struct sigaction));
|
||||||
sigact.sa_handler = sig_handler;
|
sigact.sa_handler = sig_handler;
|
||||||
sigact.sa_flags = SA_RESTART;
|
sigact.sa_flags = SA_RESTART;
|
||||||
sigaction(SIGCHLD, &sigact, NULL);
|
sigaction(SIGCHLD, &sigact, &oldact);
|
||||||
|
|
||||||
/* fork and exec shell */
|
/* fork and exec shell */
|
||||||
if ((childpid = fork_and_exec(&term->fd, term->lines, term->cols)) < 0) {
|
if ((childpid = fork_and_exec(&term->fd, term->lines, term->cols)) < 0) {
|
||||||
logging(NORMAL, "forkpty failed\n");
|
logging(NORMAL, "forkpty failed\n");
|
||||||
goto init_failed;
|
goto exec_failed;
|
||||||
}
|
}
|
||||||
|
exitcode = 0;
|
||||||
child_alive = true;
|
child_alive = true;
|
||||||
flags = fcntl(term->fd, F_GETFL);
|
flags = fcntl(term->fd, F_GETFL);
|
||||||
fcntl(term->fd, F_SETFL, flags | O_NONBLOCK);
|
fcntl(term->fd, F_SETFL, flags | O_NONBLOCK);
|
||||||
@@ -205,13 +207,9 @@ int YaFT::run(void)
|
|||||||
OnShellOutputLoop(&s, res, &ok);
|
OnShellOutputLoop(&s, res, &ok);
|
||||||
term->txt.pop();
|
term->txt.pop();
|
||||||
}
|
}
|
||||||
|
exec_failed:
|
||||||
/* normal exit */
|
sigaction(SIGCHLD, &oldact, NULL);
|
||||||
delete term;
|
|
||||||
return exitcode;
|
|
||||||
|
|
||||||
/* error exit */
|
|
||||||
init_failed:
|
init_failed:
|
||||||
delete term;
|
delete term;
|
||||||
return EXIT_FAILURE;
|
return exitcode;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user