Improved error handling

Fixes a memory leak and avoids aggressive busy looping when problems
accessing tty device.
This commit is contained in:
Martin Lund 2016-05-08 00:37:27 +02:00
parent 4c59995db8
commit ece9e7f918
5 changed files with 132 additions and 26 deletions

View file

@ -21,9 +21,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "tio/options.h"
#include "tio/tty.h"
#include "tio/log.h"
#include "tio/error.h"
#include "tio/print.h"
int main(int argc, char *argv[])
{
@ -35,6 +38,9 @@ int main(int argc, char *argv[])
/* Configure output terminal */
configure_stdout();
/* Install error exit handler */
atexit(&error_exit);
/* Install log exit handler */
atexit(&log_exit);