From 79adb44d1b85bcdd1274ed005146f752c76e945c Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Wed, 18 May 2016 22:24:24 +0200 Subject: [PATCH] Fixed some error prints --- src/log.c | 9 +++++---- src/tty.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/log.c b/src/log.c index f242606..1f04b34 100644 --- a/src/log.c +++ b/src/log.c @@ -25,9 +25,10 @@ #include #include "tio/options.h" #include "tio/print.h" +#include "tio/error.h" static FILE *fp; -static bool error = false; +static bool log_error = false; void log_open(const char *filename) { @@ -35,7 +36,7 @@ void log_open(const char *filename) if (fp == NULL) { - error = true; + log_error = true; exit(EXIT_FAILURE); } } @@ -57,6 +58,6 @@ void log_exit(void) if (option.log) log_close(); - if (error) - printf("Error: Could not open log file %s (%s)\n", option.log_filename, strerror(errno)); + if (log_error) + error_printf("Could not open log file %s (%s)", option.log_filename, strerror(errno)); } diff --git a/src/tty.c b/src/tty.c index d042823..893c132 100644 --- a/src/tty.c +++ b/src/tty.c @@ -245,7 +245,7 @@ int connect_tty(void) status = flock(fd, LOCK_EX | LOCK_NB); 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); }