Remove DB handle checker 59/238559/2
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 15 Jul 2020 05:18:08 +0000 (14:18 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 16 Jul 2020 00:23:26 +0000 (09:23 +0900)
ms_disconnect_db() checks for DB handle.

Change-Id: I545b5c8f5e5cca25c4254272276700b49ef43a8a
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/scanner-v2/media-scanner-db-manage-v2.c
src/scanner-v2/media-scanner-extract-v2.c
src/scanner-v2/media-scanner-scan-v2.c
src/server/media-server-db-manage.c
src/server/media-server-device-block.c
src/server/media-server-socket.c

index 916bce5..4ba3fc7 100755 (executable)
@@ -83,15 +83,8 @@ int msc_cleanup_invalid_values(uid_t uid)
 
        ms_connect_db(&handle, uid);
        ret = ms_cleanup_db(handle, uid);
-       if (ret != MS_MEDIA_ERR_NONE) {
-               MS_DBG_ERR("'Cleanup failed [%d]", ret);
-               return ret;
-       }
-
-       if (handle)
-               ms_disconnect_db(handle);
-
-       MS_DBG_ERR("END CLEANUP MEDIA DB");
+       ms_disconnect_db(handle);
+       MS_DBG_ERR("END CLEANUP MEDIA DB : ret[%d]", ret);
 
        return ret;
 }
index 6a0dec4..96041aa 100644 (file)
@@ -324,8 +324,7 @@ NEXT:
                }
 
                /*disconnect form media db*/
-               if (handle)
-                       ms_disconnect_db(handle);
+               ms_disconnect_db(handle);
                usleep(SCAN_SLEEP_TIME);
        }                       /*thread while*/
 
@@ -335,9 +334,7 @@ _POWEROFF:
        g_free(update_path);
        g_free(extract_data);
        g_free(storage_id);
-
-       if (handle)
-               ms_disconnect_db(handle);
+       ms_disconnect_db(handle);
 
        return NULL;
 }
@@ -457,7 +454,7 @@ NEXT:
                }
 
                /*disconnect form media db*/
-               if (handle) ms_disconnect_db(handle);
+               ms_disconnect_db(handle);
 
                /*Active flush */
                malloc_trim(0);
@@ -476,8 +473,7 @@ NEXT:
 
 _POWEROFF:
        MS_SAFE_FREE(extract_data);
-       if (handle)
-               ms_disconnect_db(handle);
+       ms_disconnect_db(handle);
 
        return NULL;
 }
index 974ef09..01c6730 100644 (file)
@@ -1207,13 +1207,13 @@ NEXT:
                MS_DBG_WARN("DIRECTORY SCAN END [%d]", ret);
 
                /*disconnect form media db*/
-               if (handle) ms_disconnect_db(handle);
+               ms_disconnect_db(handle);
                usleep(SCAN_SLEEP_TIME);
        }                       /*thread while*/
 
 _POWEROFF:
        g_free(scan_data);
-       if (handle) ms_disconnect_db(handle);
+       ms_disconnect_db(handle);
 
        return NULL;
 }
@@ -1354,7 +1354,7 @@ NEXT:
                }
 
                /*disconnect from media db*/
-               if (handle) ms_disconnect_db(handle);
+               ms_disconnect_db(handle);
 
                /*Active flush */
                malloc_trim(0);
@@ -1372,7 +1372,7 @@ NEXT:
 
 _POWEROFF:
        g_free(scan_data);
-       if (handle) ms_disconnect_db(handle);
+       ms_disconnect_db(handle);
 
        return NULL;
 }
@@ -1501,7 +1501,7 @@ static int __msc_batch_insert(int pid, GArray *path_array, uid_t uid)
        ms_batch_commit_disable(uid);
 
        /*disconnect form media db*/
-       if (handle) ms_disconnect_db(handle);
+       ms_disconnect_db(handle);
 
        return MS_MEDIA_ERR_NONE;
 }
index b27b47b..d78d0ba 100755 (executable)
@@ -93,7 +93,7 @@ static int __ms_remake_mediadb(uid_t uid)
        MS_DBG_WARN("END WRITE SCHEMA");
 
        /*disconnect form media db*/
-       if (handle) ms_disconnect_db(handle);
+       ms_disconnect_db(handle);
 
 #ifdef _USE_TVPD_MODE
        ms_config_set_int(MS_DB_RESET, 0);
index 5763975..199cc07 100644 (file)
@@ -444,7 +444,7 @@ int ms_check_mounted_storage(uid_t uid)
        }
 
        /*disconnect form media db*/
-       if (handle) ms_disconnect_db(handle);
+       ms_disconnect_db(handle);
 
        return ret;
 }
index 52390d3..06216a9 100644 (file)
@@ -185,7 +185,7 @@ static void __ms_recovery_media_db(uid_t uid)
        MS_DBG_WARN("END WRITE SCHEMA");
 
        /*disconnect form media db*/
-       if (handle) ms_disconnect_db(handle);
+       ms_disconnect_db(handle);
 
 #ifdef _USE_TVPD_MODE
        ms_check_mounted_storage(uid);