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
35
src/error.c
Normal file
35
src/error.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* tio - the simple TTY terminal I/O application
|
||||
*
|
||||
* Copyright (c) 2014-2016 Martin Lund
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "tio/options.h"
|
||||
#include "tio/print.h"
|
||||
|
||||
char *error = "";
|
||||
|
||||
void error_exit(void)
|
||||
{
|
||||
if ((error[0] != 0) && (option.no_autoconnect))
|
||||
printf("Error: %s\n", error);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue