Replace deprecated readdir_r with readdir 95/106095/1 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20161227.192128 accepted/tizen/ivi/20161226.131247 accepted/tizen/mobile/20161226.131205 accepted/tizen/tv/20161226.131214 accepted/tizen/unified/20170309.033925 accepted/tizen/wearable/20161226.131224 submit/tizen/20161226.013211 submit/tizen_unified/20170308.100409
authorKyungwook Tak <k.tak@samsung.com>
Tue, 20 Dec 2016 10:49:27 +0000 (19:49 +0900)
committerKyungwook Tak <k.tak@samsung.com>
Tue, 20 Dec 2016 10:50:19 +0000 (19:50 +0900)
Change-Id: Ic5649cafedfcb3a91c839c33f261c6da7475a9a9
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
srcs/key_handler.c

index cdc96af..c5a2f95 100644 (file)
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <dirent.h>
 #include <unistd.h>
+#include <errno.h>
 
 #include <tzplatform_config.h>
 
@@ -207,15 +208,15 @@ static int traverse_directory(const char *path, entry_callback ecb, void *user_d
        }
 
        int ret = WAE_ERROR_NONE;
-       struct dirent entry;
-       struct dirent *result = NULL;
        while (true) {
-               if (readdir_r(dir, &entry, &result) != 0) {
-                       WAE_SLOGE("readdir_r error on dir(%s) errno(%d)", path, errno);
+               errno = 0;
+               struct dirent *result = readdir(dir);
+               if (result == NULL) {
+                       if (errno != 0)
+                               WAE_SLOGE("readdir error on dir(%s) errno(%d)", path, errno);
                        break;
-               } else if (result == NULL) {
-                       break; // end of directory
-               } else if (strcmp(entry.d_name, ".") == 0 || strcmp(entry.d_name, "..") == 0) {
+               } else if (strcmp(result->d_name, ".") == 0 ||
+                       strcmp(result->d_name, "..") == 0) {
                        continue;
                }