Replace 'readdir_r' with 'readdir'
[platform/core/appfw/app2sd.git] / plugin / app2sd / server / app2sd_interface.c
index 37a66da..31882e2 100644 (file)
@@ -1289,15 +1289,13 @@ int app2sd_usr_force_clean(const char *pkgid, uid_t uid)
 int app2sd_enable_full_pkg(void)
 {
        int ret = APP2EXT_SUCCESS;
-       int rc = 0;
        char buf[FILENAME_MAX] = { 0, };
        char app2sd_path[FILENAME_MAX] = { 0, };
        char loopback_device[FILENAME_MAX] = { 0, };
        char *sdpath = NULL;
        char *pkgid = NULL;
        DIR *dir = NULL;
-       struct dirent entry;
-       struct dirent *result = NULL;
+       struct dirent *entry = NULL;
        uid_t uid = 0;
 
        /* check whether MMC is present or not */
@@ -1324,14 +1322,12 @@ int app2sd_enable_full_pkg(void)
                return APP2EXT_ERROR_SQLITE_REGISTRY;
        }
 
-       for (rc = readdir_r(dir, &entry, &result);
-               rc == 0 && result != NULL;
-               rc = readdir_r(dir, &entry, &result)) {
-               if (strcmp(entry.d_name, ".") == 0 ||
-                       strcmp(entry.d_name, "..") == 0)
+       while ((entry = readdir(dir)) != NULL) {
+               if (strcmp(entry->d_name, ".") == 0 ||
+                       strcmp(entry->d_name, "..") == 0)
                        continue;
                snprintf(loopback_device, FILENAME_MAX - 1, "%s/%s",
-                       app2sd_path, entry.d_name);
+                       app2sd_path, entry->d_name);
                ret = _app2sd_get_info_from_db(loopback_device,
                        &pkgid, &uid);
                if (ret) {