mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Improved error handling
Fixes a memory leak and avoids aggressive busy looping when problems accessing tty device.
This commit is contained in:
parent
4c59995db8
commit
ece9e7f918
5 changed files with 132 additions and 26 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue