Remove meaningless code 08/312508/1
authorMinje Ahn <minje.ahn@samsung.com>
Tue, 11 Jun 2024 02:11:19 +0000 (11:11 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Tue, 11 Jun 2024 02:11:19 +0000 (11:11 +0900)
This code is meaningless for the following reasons:
  1. If there is no db file, media_db_connect() creates one.
  2. 'pragma integrity_check' is a command for checking consistency of db.
     Therefore, it is independent of file size.

Change-Id: If906853134116965691bc3998cd8f2262cb5f219
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
svc/media_controller_svc.c

index 73ed942..b618390 100644 (file)
@@ -18,7 +18,6 @@
 #include <systemd/sd-daemon.h>
 #include <systemd/sd-login.h>
 #include <gio/gio.h>
-#include <sys/stat.h>
 #include <aul.h>
 
 #include "media_controller_svc.h"
@@ -181,33 +180,6 @@ static int __mc_service_check_db(uid_t uid)
 {
        int res = MEDIA_CONTROLLER_ERROR_NONE;
        sqlite3 *db_handle = NULL;
-       char *db_path = NULL;
-       struct stat buf;
-
-       db_path = mc_db_get_db_path(uid);
-       mc_retvm_if(db_path == NULL, res, "Failed to get the db_path");
-
-       /* Check the database exists */
-       if (!g_file_test(db_path, G_FILE_TEST_EXISTS)) {
-               mc_error("[NO-ERROR] DB is not created yet, do not need to check DB");
-               g_free(db_path);
-               return MEDIA_CONTROLLER_ERROR_NONE;
-       }
-
-       /* Check the size of database */
-       if (stat(db_path, &buf) == 0) {
-               if (buf.st_size == 0) {
-                       mc_warning("The size of database is 0, it's ok");
-                       g_free(db_path);
-                       return MEDIA_CONTROLLER_ERROR_NONE;
-               }
-       } else {
-               mc_stderror("stat failed");
-               g_free(db_path);
-               return MEDIA_CONTROLLER_ERROR_INVALID_OPERATION;
-       }
-
-       g_free(db_path);
 
        /* Connect media controller DB*/
        res = mc_db_connect(&db_handle, uid, TRUE);