Fixed some error prints

This commit is contained in:
Martin Lund 2016-05-18 22:24:24 +02:00
parent dd49d07547
commit 79adb44d1b
2 changed files with 6 additions and 5 deletions

View file

@ -25,9 +25,10 @@
#include <errno.h> #include <errno.h>
#include "tio/options.h" #include "tio/options.h"
#include "tio/print.h" #include "tio/print.h"
#include "tio/error.h"
static FILE *fp; static FILE *fp;
static bool error = false; static bool log_error = false;
void log_open(const char *filename) void log_open(const char *filename)
{ {
@ -35,7 +36,7 @@ void log_open(const char *filename)
if (fp == NULL) if (fp == NULL)
{ {
error = true; log_error = true;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -57,6 +58,6 @@ void log_exit(void)
if (option.log) if (option.log)
log_close(); log_close();
if (error) if (log_error)
printf("Error: Could not open log file %s (%s)\n", option.log_filename, strerror(errno)); error_printf("Could not open log file %s (%s)", option.log_filename, strerror(errno));
} }

View file

@ -245,7 +245,7 @@ int connect_tty(void)
status = flock(fd, LOCK_EX | LOCK_NB); status = flock(fd, LOCK_EX | LOCK_NB);
if ((status == -1) && (errno == EWOULDBLOCK)) if ((status == -1) && (errno == EWOULDBLOCK))
{ {
printf("Error: Device file is locked by another process\r\n"); error_printf("Device file is locked by another process");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }