Deprecated readdir_r() removed 23/117823/1 accepted/tizen_mobile accepted/tizen/mobile/20170308.120318 accepted/tizen/unified/20170310.080602 submit/tizen/20170308.020113 submit/tizen_unified/20170310.011402
authorRadek Kintop <r.kintop@samsung.com>
Tue, 7 Mar 2017 13:18:44 +0000 (14:18 +0100)
committerRadek Kintop <r.kintop@samsung.com>
Tue, 7 Mar 2017 13:18:44 +0000 (14:18 +0100)
Change-Id: I9b2a157505cb66fe0ca1ce439578bf2ae5a947a2
Signed-off-by: Radek Kintop <r.kintop@samsung.com>
setting-ringtone/src/setting-ringtone-util.c

index 5fccdf079a7262abd6d296366be3f076cec1689a..6e3cddca617587213053664e972f30751ef3f4db 100644 (file)
@@ -60,7 +60,7 @@ int get_filelist_from_dir_path(char *path, Eina_List **file_list)
 {
        SETTING_TRACE_BEGIN;
        DIR *pDir = NULL;
-       struct dirent ent, *result;
+       const struct dirent *ent = NULL;
 
        retvm_if(path == NULL, -1, "dir path is null");
        retvm_if(file_list == NULL, -1, "file_list is null");
@@ -70,29 +70,25 @@ int get_filelist_from_dir_path(char *path, Eina_List **file_list)
        if (pDir == NULL)
                return -2;
 
-       while (readdir_r(pDir, &ent, &result) == 0) {
-               if (result == NULL)
-                       break;
+       while ((ent = readdir(pDir)) != NULL) {
 
                fileNodeInfo *pNode = NULL;
 
-               if (strncmp(ent.d_name, ".", 1) == 0
-                               || strcmp(ent.d_name, "..") == 0)
+               if (strncmp(ent->d_name, ".", 1) == 0 || strcmp(ent->d_name, "..") == 0)
                        continue;
 
-               if ((ent.d_type & DT_REG) == 0)
+               if ((ent->d_type & DT_REG) == 0)
                        continue;
 
                pNode = (fileNodeInfo *)malloc(sizeof(fileNodeInfo));
-               if (pNode == NULL)
+               if (!pNode)
                        continue;
 
                memset(pNode, 0, sizeof(fileNodeInfo));
 
                pNode->path = strdup(path);
-               pNode->name = strdup(ent.d_name);
-               pNode->media_name = get_media_basename(
-                               pNode->path, pNode->name);
+               pNode->name = strdup(ent->d_name);
+               pNode->media_name = get_media_basename(pNode->path, pNode->name);
 
                *file_list = eina_list_append(*file_list, pNode);
        }