[Title] emulator-x86 cause SEGV when the binary run without vtm.
authorkt920.kim <kt920.kim@samsung.com>
Tue, 6 Dec 2011 11:35:22 +0000 (20:35 +0900)
committerkt920.kim <kt920.kim@samsung.com>
Tue, 6 Dec 2011 11:35:22 +0000 (20:35 +0900)
[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]

tizen/src/debug_ch.c
tizen/src/emulator.c
tizen/src/fileio.c
tizen/src/process.c

index 0c55ff0..9827e2f 100644 (file)
@@ -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);
index 6e7ea82..b63d5b6 100644 (file)
@@ -537,6 +537,7 @@ static void init_startup_option(void)
        }
        
        startup_option.no_dump = FALSE;
+       startup_option.vtm = "default";
 }
 
 
index bc85479..d260d02 100644 (file)
@@ -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 
                {
index 14f57cc..8ef9261 100644 (file)
@@ -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));