From: Munkyu Im Date: Wed, 30 Jul 2014 07:49:52 +0000 (+0900) Subject: debugch: Fix DEBUGCH and open flag X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~620^2~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aafaeefd0dbb8c6fbc8ffd4643acac7bc16d8f10;p=sdk%2Femulator%2Fqemu.git debugch: Fix DEBUGCH and open flag Add O_APPEND to support writing stdout, stderr logs. Set global variable for checking initailize earlier. So succeded to read DEBUGCH file now. Change-Id: I9eaef10ce81e138b613223417985acf27533b7bc Signed-off-by: Munkyu Im --- diff --git a/tizen/src/util/new_debug_ch.c b/tizen/src/util/new_debug_ch.c index 4effe690a2..b871522e71 100644 --- a/tizen/src/util/new_debug_ch.c +++ b/tizen/src/util/new_debug_ch.c @@ -225,6 +225,7 @@ static void debug_init(void) return; /* already initialized */ } + nb_debug_options = 0; if (0 == strlen(bin_path)) { g_strlcpy(debugchfile, "DEBUGCH", MAX_FILE_LEN); } else { @@ -237,6 +238,7 @@ static void debug_init(void) debug = getenv("DEBUGCH"); } else { if ((tmp = (char *)malloc(1024 + 1)) == NULL){ + nb_debug_options = -1; fclose(fp); return; } @@ -248,6 +250,7 @@ static void debug_init(void) if (tmp != NULL) free(tmp); + nb_debug_options = -1; return; } const char* str = fgets(tmp, 1024, fp); @@ -272,7 +275,7 @@ static void debug_init(void) // If "log_path" is not set, we use "stdout". if (log_path[0] != '\0') { - fd = qemu_open(log_path, O_RDWR | O_CREAT | O_TRUNC, 0666); + fd = qemu_open(log_path, O_RDWR | O_CREAT | O_TRUNC | O_APPEND, 0666); if (fd < 0) { fprintf(stderr, "Can't open logfile: %s\n", log_path); exit(1);