From c441a2c6def4b3660e735480145d43296eef6135 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Fri, 13 Aug 2021 15:21:01 +0900 Subject: [PATCH] vip-process: print dlog in vip_print_console() Change-Id: I764b1ef75c76ab61e28044ee044f8a89a3f3499b Signed-off-by: Youngjae Cho --- src/vip-agent/vip-process.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/vip-agent/vip-process.c b/src/vip-agent/vip-process.c index e48892b..4743833 100644 --- a/src/vip-agent/vip-process.c +++ b/src/vip-agent/vip-process.c @@ -63,28 +63,20 @@ static void vip_print_console(const char *format, ...) { FILE *fp = NULL; char buffer[256] = {0, }; - int eno; va_list ap; + va_start(ap, format); + vsnprintf(buffer, sizeof(buffer), format, ap); + va_end(ap); + fp = fopen("/dev/console", "a"); if (!fp) { - eno = errno; - - va_start(ap, format); - vsnprintf(buffer, 256, format, ap); - va_end(ap); - - errno = eno; _E("%s(failed to print log on console, %m)", buffer); - return; } - va_start(ap, format); - vfprintf(fp, format, ap); - va_end(ap); - - fprintf(fp, "\n"); + _D("%s", buffer); + fprintf(fp, "%s\n", buffer); fclose(fp); } -- 2.7.4