check usb path before use 40/199340/1
authorchengyj1985 <yujie.cheng@samsung.com>
Sun, 10 Feb 2019 04:36:46 +0000 (12:36 +0800)
committerchengyj1985 <yujie.cheng@samsung.com>
Sun, 10 Feb 2019 04:36:46 +0000 (12:36 +0800)
Change-Id: I3e89734c0ced73a028c6c743a99eb4705360c811

src/scanner-v2/media-scanner-scan-v2.c

index b6908db..cc0e674 100755 (executable)
@@ -850,6 +850,11 @@ NEXT_SCAN:
                usleep(SCAN_SLEEP_TIME);
        }
 
+       if (!MS_STRING_VALID(MEDIA_ROOT_PATH_USB)) {
+               MS_DBG_ERR("Fail to get USB path");
+               goto EXIT;
+       }
+
        if (strstr(new_start_path, MEDIA_ROOT_PATH_USB) != NULL) {
                if (!ms_storage_mount_status(new_start_path)) {
                        MS_DBG_ERR("start path is unmounted");
@@ -977,6 +982,11 @@ int __msc_dir_and_storage_scan_same_path(char *start_path)
        char *remain_path = NULL;
        int remain_len = 0;
 
+       if (!MS_STRING_VALID(MEDIA_ROOT_PATH_USB)) {
+               MS_DBG_ERR("Fail to get USB path");
+               return MS_MEDIA_ERR_INTERNAL;
+       }
+
        remain_path = strstr(start_path+strlen(MEDIA_ROOT_PATH_USB) +1, "/");
        if (remain_path != NULL)
                remain_len = strlen(remain_path);