Replace 'readdir_r' with 'readdir'
[platform/core/appfw/app2sd.git] / plugin / app2sd / common / src / app2sd_utils.c
index e2e1a8d..270f5fc 100644 (file)
@@ -50,18 +50,17 @@ char *_app2sd_get_encoded_name(const char *pkgid, uid_t uid)
 int _app2sd_delete_directory(const char *dirname)
 {
        DIR *dp = NULL;
-       struct dirent ep;
-       struct dirent *er = NULL;
+       struct dirent *ep = NULL;
        char abs_filename[FILENAME_MAX] = { 0, };
        int ret = 0;
 
        dp = opendir(dirname);
        if (dp != NULL) {
-               while (readdir_r(dp, &ep, &er) == 0 && er != NULL) {
+               while ((ep = readdir(dp)) != NULL) {
                        struct stat stFileInfo;
 
                        snprintf(abs_filename, FILENAME_MAX, "%s/%s", dirname,
-                               ep.d_name);
+                               ep->d_name);
 
                        if (lstat(abs_filename, &stFileInfo) < 0) {
                                perror(abs_filename);
@@ -70,8 +69,8 @@ int _app2sd_delete_directory(const char *dirname)
                        }
 
                        if (S_ISDIR(stFileInfo.st_mode)) {
-                               if (strcmp(ep.d_name, ".")
-                                   && strcmp(ep.d_name, "..")) {
+                               if (strcmp(ep->d_name, ".")
+                                   && strcmp(ep->d_name, "..")) {
                                        ret = _app2sd_delete_directory(abs_filename);
                                        if (ret < 0) {
                                                (void)closedir(dp);