Check RW mount 90/240290/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 5 Aug 2020 05:52:26 +0000 (14:52 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 5 Aug 2020 06:05:35 +0000 (15:05 +0900)
Change-Id: Ie8fc9c7a7a4023d48c57b871d2a0366526388772
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
receiver/src/main.cpp
receiver/src/sticker_log.cpp

index b874611..d8797dd 100644 (file)
@@ -33,6 +33,8 @@
 
 using namespace std;
 
+static bool check_rw_mount();
+
 static bool app_create(void *data)
 {
     /* Hook to take necessary actions before main event loop starts
@@ -40,6 +42,11 @@ static bool app_create(void *data)
        If this function returns true, the main loop of application starts
        If this function returns false, the application is terminated */
 
+    if (!check_rw_mount()) {
+        service_app_exit();
+        return true;
+    }
+
     LOGD("");
 
     char log_path[PATH_MAX];
index 1faffd5..8b9a3a7 100644 (file)
@@ -42,10 +42,17 @@ void sticker_save_log(const char *fmt, ...)
 
     char *data_path = NULL;
     data_path = app_get_shared_data_path();
+    if (!data_path)
+        return;
+
     snprintf(log_path, sizeof(log_path), "%s/log", data_path);
 
-    if (data_path)
+    if (access(data_path, R_OK) != 0) {
         free(data_path);
+        return;
+    }
+
+    free(data_path);
 
     int idx = 0;
     if (preference_get_int(LAST_LOG_FILE_INDEX, &idx) != PREFERENCE_ERROR_NONE) {