From a6e470df65bb02ec34319af91f0c5d6cd35fce65 Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Mon, 16 Jun 2014 16:16:12 +0900 Subject: [PATCH] emulator: revert SDL_init() routes stdout and stderr in win32 SDL_init() routes stdout and stderr to the respective files in win32. So we revert it. Prevent NULL dereferencing in g_ascii_strtoull(). Change-Id: I0e540f83a7701968746310035a580eadd8160ce6 Signed-off-by: SeokYeon Hwang --- tizen/src/emulator.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 66919d3227..c7efcc2313 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -303,6 +303,13 @@ static int emulator_main(int argc, char *argv[], char **envp) } #endif +#ifdef CONFIG_WIN32 + // SDL_init() routes stdout and stderr to the respective files in win32. + // So we revert it. + freopen("CON", "w", stdout); + freopen("CON", "w", stderr); +#endif + gchar *profile = NULL; int c = 0; @@ -364,13 +371,18 @@ static int emulator_main(int argc, char *argv[], char **envp) char *resolution = get_variable("resolution"); if (!resolution) { fprintf(stderr, "[resolution] is required.\n"); + return -1; } char **splitted = g_strsplit(resolution, "x", 2); if (!splitted[0] || !splitted[1]) { fprintf(stderr, "resolution value [%s] is weird. Please use format \"WIDTHxHEIGHT\"\n", resolution); + g_strfreev(splitted); + return -1; } - set_emul_resolution(g_ascii_strtoull(splitted[0], NULL, 0), + else { + set_emul_resolution(g_ascii_strtoull(splitted[0], NULL, 0), g_ascii_strtoull(splitted[1], NULL, 0)); + } g_strfreev(splitted); } -- 2.34.1