diff options
-rw-r--r-- | tizen/src/emulator.c | 5 | ||||
-rw-r--r-- | tizen/src/util/osutil-win32.c | 6 | ||||
-rw-r--r-- | tizen/src/util/osutil.c | 12 |
3 files changed, 16 insertions, 7 deletions
diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index e4a170754b..b63d020518 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -317,6 +317,11 @@ static int emulator_main(int argc, char *argv[], char **envp) set_bin_path_os(_qemu_argv[0]); if (launch_conf_file) { + if (!g_file_test(launch_conf_file, G_FILE_TEST_EXISTS)) { + fprintf(stderr, "conf_file(%s) does not exist.\n", launch_conf_file); + return -1; + } + make_vm_lock_os(g_path_get_dirname(launch_conf_file)); if (!load_conf(launch_conf_file)) { return -1; diff --git a/tizen/src/util/osutil-win32.c b/tizen/src/util/osutil-win32.c index f733aedc67..48220da10c 100644 --- a/tizen/src/util/osutil-win32.c +++ b/tizen/src/util/osutil-win32.c @@ -94,6 +94,10 @@ void make_vm_lock_os(gchar *vms_path) if (g_mkdir_with_parents(g_path_get_dirname(lock_filename), 0777)) { LOG_WARNING("Can not create directory for lock file: %ld\n", GetLastError()); + // do not create the lock file. + g_free(lock_filename); + lock_filename = NULL; + return; } lock_file = CreateFile(lock_filename, GENERIC_READ | GENERIC_WRITE, @@ -107,6 +111,8 @@ void make_vm_lock_os(gchar *vms_path) // On Windows, the file opened by CreateFile has exclusive lock // naturally unless FILE_SHARE_* attribute is set. if (error == ERROR_SHARING_VIOLATION) { + g_free(lock_filename); + lock_filename = NULL; error_report("Can not execute this VM. " "The same VM may be running now."); exit(1); diff --git a/tizen/src/util/osutil.c b/tizen/src/util/osutil.c index de78c53d42..540579381b 100644 --- a/tizen/src/util/osutil.c +++ b/tizen/src/util/osutil.c @@ -145,9 +145,10 @@ retry: error = errno; LOG_WARNING("Failed to open file for lock(%d): %s\n", error, strerror(error)); - error_report("Can not execute this VM. " - "The same VM may be running now."); - exit(1); + // do not create the lock file. + g_free(lock_filename); + lock_filename = NULL; + return; } if (fd_lock(lock_file) == -1) { @@ -165,10 +166,7 @@ retry: exit(1); } - LOG_WARNING("Failed to lock image file: %s\n", strerror(error)); - close(lock_file); - lock_file = -1; - return; + LOG_WARNING("Failed to lock file: %s\n", strerror(error)); } emulator_add_exit_notifier(&remove_lock); |