#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"
{
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);