From: kt920.kim Date: Tue, 6 Dec 2011 11:35:22 +0000 (+0900) Subject: [Title] emulator-x86 cause SEGV when the binary run without vtm. X-Git-Tag: TizenStudio_2.0_p2.3~1694^2~204^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1d9a293f5242556b66ccc16d8cf69deece1d43ba;p=sdk%2Femulator%2Fqemu.git [Title] emulator-x86 cause SEGV when the binary run without vtm. [Type] Bug fix [Module] [Priority] [CQ#] [Redmine#] [Problem] When users run emulator-x86 binary on the shell without vtm, it causes SEGV. [Cause] There is no exception handling in case of the above situation. [Solution] Inserts some exception handling codes. [TestCase] --- diff --git a/tizen/src/debug_ch.c b/tizen/src/debug_ch.c index 0c55ff0..9827e2f 100644 --- a/tizen/src/debug_ch.c +++ b/tizen/src/debug_ch.c @@ -316,7 +316,10 @@ static int dbg_vprintf( const char *format, va_list args ) // unlock if ((fp = fopen(logfile, "a+")) == NULL) { - fprintf(stdout, "log file can't open.(%s)\n", logfile); + fprintf(stdout, "Emulator can't open (%s).\n" + "Please check whether or not " + "this emulator is running on the installation path.\n", logfile); + exit(1); } fputs(txt, fp); diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 6e7ea82..b63d5b6 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -537,6 +537,7 @@ static void init_startup_option(void) } startup_option.no_dump = FALSE; + startup_option.vtm = "default"; } diff --git a/tizen/src/fileio.c b/tizen/src/fileio.c index bc85479..d260d02 100644 --- a/tizen/src/fileio.c +++ b/tizen/src/fileio.c @@ -171,9 +171,9 @@ const gchar *get_path(void) if(!arch) /* for stand alone */ { char *binary = g_path_get_basename(vtm_path); - if(strcmp(binary, "emulator-x86") == 0) + if(strstr(binary, "emulator-x86")) arch = g_strdup_printf("x86"); - else if(strcmp(binary, "emulator-arm") == 0) + else if(strstr(binary, "emulator-arm")) arch = g_strdup_printf("arm"); else { @@ -202,9 +202,9 @@ const gchar *get_abs_path(void) if(!arch) /* for stand alone */ { char *binary = g_path_get_basename(vtm_path); - if(strcmp(binary, "emulator-x86") == 0) + if(strstr(binary, "emulator-x86")) arch = g_strdup_printf("x86"); - else if(strcmp(binary, "emulator-arm") == 0) + else if(strstr(binary, "emulator-arm")) arch = g_strdup_printf("arm"); else { diff --git a/tizen/src/process.c b/tizen/src/process.c index 14f57cc..8ef9261 100644 --- a/tizen/src/process.c +++ b/tizen/src/process.c @@ -216,11 +216,10 @@ int write_pidfile(const char *filename) } if ((fd = open(pidfname, O_RDWR | O_CREAT, 0666)) < 0) { - ERR( "%s at %s(%d)\n", strerror(errno), __FILE__, __LINE__); - return -1; + ERR("Failed to create emulator.pid file\n"); + ERR("%s at %s(%d)\n", strerror(errno), __FILE__, __LINE__); + exit(1); } - - /* ±âÁ¸ ³»¿ë »èÁ¦ */ ftruncate(fd, 0); memset(buf, 0, sizeof(buf));