Prevent crash in the encryption mode 96/240196/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 4 Aug 2020 06:02:55 +0000 (15:02 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 4 Aug 2020 06:02:55 +0000 (15:02 +0900)
Change-Id: I65dd85d659da0d530b3fdffd637fbcb37bd172ac
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
receiver/src/main.cpp

index 8f40413..f5d8120 100644 (file)
@@ -125,6 +125,25 @@ static bool check_sync_time_condition()
     return result;
 }
 
+bool check_rw_mount()
+{
+    char *data_path = NULL;
+    bool rw_mount = false;
+    data_path = app_get_shared_data_path();
+    if (!data_path) return false;
+
+    if (access(data_path, R_OK) == 0)
+        rw_mount = true;
+
+    free(data_path);
+
+    if (!rw_mount) {
+        SECURE_LOGE("Can't access rw storage\n");
+    }
+
+    return rw_mount;
+}
+
 static void app_control(app_control_h app_control, void *data)
 {
     /* Handle the launch request. */
@@ -137,6 +156,9 @@ static void app_control(app_control_h app_control, void *data)
     const char *event_uri = "event://tizen.system.event.battery_charger_status";
     int res;
 
+    if (!check_rw_mount())
+        service_app_exit();
+
     // operation
     int ret = app_control_get_operation(app_control, &operation);
     if (ret == APP_CONTROL_ERROR_NONE) {