From: SeokYeon Hwang Date: Wed, 23 Apr 2014 06:44:28 +0000 (+0900) Subject: log: a "debug_ch" can use stdout now X-Git-Tag: TizenStudio_2.0_p2.3~226^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F21723%2F1;p=sdk%2Femulator%2Fqemu.git log: a "debug_ch" can use stdout now If "log_path" is not set, "debug_ch" use stdout. It is only for arguments renewal. A "debug_ch" should be refactored. Change-Id: Iaa0d102800ac480e12106ef3d11282d50f20edd8 Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/debug_ch.c b/tizen/src/debug_ch.c index 2451993..ea43d45 100644 --- a/tizen/src/debug_ch.c +++ b/tizen/src/debug_ch.c @@ -280,8 +280,6 @@ static void debug_init(void) char *debug = NULL; FILE *fp = NULL; char *tmp = NULL; - int open_flags; - int fd; if (nb_debug_options != -1) { return; /* already initialized */ @@ -338,15 +336,6 @@ static void debug_init(void) if (tmp != NULL) { free(tmp); } - - open_flags = O_BINARY | O_RDWR | O_CREAT | O_TRUNC; - fd = qemu_open(log_path, open_flags, 0666); - if (fd < 0) { - fprintf(stderr, "Can't open logfile: %s\n", log_path); - exit(1); - } - - close(fd); } /* allocate some tmp string space */ @@ -477,6 +466,12 @@ int dbg_log(enum _debug_class cls, struct _debug_channel *channel, ret += vsnprintf(buf_msg + ret, sizeof(buf_msg) - ret, format, valist); va_end(valist); + // If "log_path" is not set, we use "stdout". + if (log_path[0] == '\0') { + fprintf(stdout, "%s", buf_msg); + return ret; + } + open_flags = O_RDWR | O_APPEND | O_BINARY | O_CREAT; fd = qemu_open(log_path, open_flags, 0666);