summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyungwook Tak <k.tak@samsung.com>2016-12-20 10:49:27 (GMT)
committerKyungwook Tak <k.tak@samsung.com>2016-12-20 10:50:19 (GMT)
commit66e03d5f1993d5bdf9c0c0b778afdf99eefff847 (patch)
tree9edd3f1c0e7dd8e39e8bcc31c61d513999f6a8de
parent9fddab9e58ccd9acdecdbfcf12770c50feac4d2b (diff)
downloadlibwebappenc-accepted/tizen_wearable.zip
libwebappenc-accepted/tizen_wearable.tar.gz
libwebappenc-accepted/tizen_wearable.tar.bz2
Change-Id: Ic5649cafedfcb3a91c839c33f261c6da7475a9a9 Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
-rw-r--r--srcs/key_handler.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/srcs/key_handler.c b/srcs/key_handler.c
index cdc96af..c5a2f95 100644
--- a/srcs/key_handler.c
+++ b/srcs/key_handler.c
@@ -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;
}