memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sun_family = AF_UNIX;
MSAPI_DBG("%s", sock_info->sock_path);
- unlink(sock_info->sock_path);
- strncpy(serv_addr.sun_path, sock_info->sock_path, strlen(sock_info->sock_path));
-
+ if (sock_info->sock_path != NULL) {
+ unlink(sock_info->sock_path);
+ strncpy(serv_addr.sun_path, sock_info->sock_path, strlen(sock_info->sock_path));
+ }
/* Bind to the local address */
if (bind(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
MSAPI_DBG_STRERROR("bind failed");
int ret = MS_MEDIA_ERR_NONE;
char *dir_path = NULL;
char *leaf_path = NULL;
+ char *user_path = NULL;
ret = __msc_check_file_path(full_path, uid);
if (ret != MS_MEDIA_ERR_NONE) {
}
/*If root path, Stop Scanning*/
- if (strcmp(dir_path, __msc_get_path(uid)) == 0)
+ user_path = __msc_get_path(uid);
+ if (user_path == NULL) {
+ ret = MS_MEDIA_ERR_INTERNAL;
+ break;
+ }
+
+ if (strcmp(dir_path, user_path) == 0)
break;
else if (MS_STRING_VALID(MEDIA_ROOT_PATH_SDCARD) && (strcmp(dir_path, MEDIA_ROOT_PATH_SDCARD) == 0))
break;
}
MS_SAFE_FREE(dir_path);
+ MS_SAFE_FREE(user_path);
return ret;
}