aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-03-19 16:25:11 +0000
committerMåns Rullgård <mans@mansr.com>2010-03-19 16:25:11 +0000
commit9a9509e6eeac6c0b8b7ca7a60ccb712ed4960566 (patch)
tree5ebe90104c16fab342c7c4345db5feae81de80dc
parentf5af8f162584d08af3de74ee807bbd8130763238 (diff)
downloadffmpeg-9a9509e6eeac6c0b8b7ca7a60ccb712ed4960566.tar.gz
Register atexit handler only when needed
Originally committed as revision 22599 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffmpeg.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 5a22dde46b..5e35022688 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -318,14 +318,12 @@ typedef struct AVInputFile {
/* init terminal so that we can grab keys */
static struct termios oldtty;
-#endif
static void term_exit(void)
{
-#if HAVE_TERMIOS_H
tcsetattr (0, TCSANOW, &oldtty);
-#endif
}
+#endif
static volatile int received_sigterm = 0;
@@ -343,6 +341,7 @@ static void term_init(void)
tcgetattr (0, &tty);
oldtty = tty;
+ atexit(term_exit);
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
@@ -363,10 +362,6 @@ static void term_init(void)
signal(SIGXCPU, sigterm_handler);
#endif
- /*
- register a function to be called at normal program termination
- */
- atexit(term_exit);
#if CONFIG_BEOS_NETSERVER
fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
#endif