err = __msc_set_power_mode(status);
if (err != MS_MEDIA_ERR_NONE) {
- MS_DBG_ERR("__msc_tv_set_power_mode fail");
+ MS_DBG_ERR("__msc_set_power_mode fail");
res = err;
}
}
}
} else if (entry.d_type & DT_DIR) {
- if (scan_type != MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
+ if (scan_type != MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
/* this request is recursive scanning */
/* add new directory to dir_array */
new_path = strdup(path);
/* this thread process only the request of media-server */
static int _check_folder_from_list(char *folder_path, GArray *dir_array)
{
- int i;
+ int i = 0;
int array_len = dir_array->len;
ms_dir_info_s* dir_info = NULL;
struct stat buf;
MS_DBG_ERR("MALLOC failed");
return MS_MEDIA_ERR_OUT_OF_MEMORY;
}
+ memset(dir_info, 0, sizeof(ms_dir_info_s));
dir_info->dir_path = strdup(folder_path);
dir_info->modified_time = -1;
g_array_append_val(dir_array, dir_info);
/*get directories list from media db*/
ret = ms_get_folder_list(handle, storage_id, start_path, dir_array);
if (ret != MS_MEDIA_ERR_NONE) {
- MS_DBG_ERR("msc_tv_get_folder_list is failed", ret);
+ MS_SAFE_FREE(start_path);
+ MS_DBG_ERR("ms_get_folder_list is failed", ret);
return ret;
}
goto _POWEROFF;
}
- MS_DBG_ERR("STORAGE SCAN START [%s]", scan_data->msg);
+ MS_DBG_ERR("[No-Error] STORAGE SCAN START [%s][%s]", scan_data->msg, scan_data->storage_id);
scan_type = scan_data->msg_type;
if (scan_type != MS_MSG_STORAGE_ALL
MS_DBG_ERR("msc_delete_all_record fails");
}
} else if (scan_type == MS_MSG_STORAGE_PARTIAL) {
- ms_validaty_change_all_items(handle, scan_data->storage_id, storage_type, false, scan_data->uid);
+ ms_validaty_change_all_items(handle, scan_data->storage_id, storage_type, false, scan_data->uid);
}
ret = __msc_db_update(handle, scan_data->storage_id, scan_data);
goto _POWEROFF;
}
- /*disconnect form media db*/
+ /*disconnect from media db*/
if (handle) ms_disconnect_db(&handle);
/*Active flush */
}
if (ret != MS_MEDIA_ERR_NONE) {
- MS_DBG_ERR("__msc_tv_pop_register_request failed [%d]", ret);
+ MS_DBG_ERR("__msc_pop_register_request failed [%d]", ret);
goto FREE_RESOURCE;
}
file_path = strndup(register_data->msg, register_data->msg_size);
if (file_path == NULL) {
- MS_DBG_ERR("file path is NULL");
+ MS_DBG_ERR("file_path is NULL");
goto FREE_RESOURCE;
}
ret = __msc_make_file_list(file_path, &path_array, register_data->uid);
if (ret != MS_MEDIA_ERR_NONE) {
- MS_DBG_ERR("__msc_tv_make_file_list failed [%d]", ret);
+ MS_DBG_ERR("__msc_make_file_list failed [%d]", ret);
goto FREE_RESOURCE;
}
return MS_MEDIA_ERR_NONE;
}
+
int msc_deinit_scanner(void)
{
if (scan_queue2) g_async_queue_unref(scan_queue2);
continue;
}
} else if (entry.d_type & DT_DIR) {
- if (scan_type != MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
+ if (scan_type != MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
/* this request is recursive scanning */
/* add new directory to dir_array */
new_path = strdup(path);
STOP_SCAN:
if (dp) closedir(dp);
+ dp = NULL;
MS_SAFE_FREE(new_start_path);
/* check the file exits actually */
exist = open(file_path, O_RDONLY);
if (exist < 0) {
- MS_DBG_STRERROR("Open failed");
- MS_DBG_ERR("error path [%s]", file_path);
+ MS_DBG_ERR("[%s]open files");
return MS_MEDIA_ERR_INVALID_PATH;
}
close(exist);
int msc_send_power_off_request(void)
{
- ms_comm_msg_s *data;
+ ms_comm_msg_s *data = NULL;
power_off = true;
data->pid = POWEROFF;
msc_push_scan_request(MS_SCAN_DIRECTORY, data);
} else {
- MS_DBG_ERR("memory allocation fail");
+ MS_DBG_ERR("memory allocation failed");
}
}
data->pid = POWEROFF;
msc_push_scan_request(MS_SCAN_REGISTER, data);
} else {
- MS_DBG_ERR("memory allocation fail");
+ MS_DBG_ERR("memory allocation failed");
}
}
data->pid = POWEROFF;
msc_push_scan_request(MS_SCAN_STORAGE, data);
} else {
- MS_DBG_ERR("memory allocation fail");
+ MS_DBG_ERR("memory allocation failed");
}
}