summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSukHyung, Kang <shine.kang@samsung.com>2016-03-18 10:33:24 +0900
committerSukHyung, Kang <shine.kang@samsung.com>2016-03-18 16:48:59 +0900
commita8d4aef955a5afaaacea03c0cd495298eda08ed9 (patch)
tree054a2ebb7016e2308177b9947adab9a4a9d94cd8
parent58d34a7388c3c5b5c116c54c28abda28f826e3bb (diff)
downloadwidget-service-a8d4aef955a5afaaacea03c0cd495298eda08ed9.tar.gz
widget-service-a8d4aef955a5afaaacea03c0cd495298eda08ed9.tar.bz2
widget-service-a8d4aef955a5afaaacea03c0cd495298eda08ed9.zip
Change-Id: I2011ebc0bf534098f2732ab05d65d2bc12d1253c Signed-off-by: SukHyung, Kang <shine.kang@samsung.com>
-rw-r--r--src/widget_conf.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/widget_conf.c b/src/widget_conf.c
index e1bc98d..9ce3364 100644
--- a/src/widget_conf.c
+++ b/src/widget_conf.c
@@ -705,7 +705,8 @@ static char *parse_handler(const char *buffer)
static char *find_input_device_by_path(const char *name)
{
DIR *dir;
- struct dirent *entry;
+ struct dirent entry;
+ struct dirent *result;
char path[PATH_MAX];
char *ptr;
int len;
@@ -725,13 +726,14 @@ static char *find_input_device_by_path(const char *name)
ptr = path + len;
len = PATH_MAX - len - 1;
- while ((entry = readdir(dir))) {
- if (entry->d_name[0] == '.' &&
- (entry->d_name[1] == '\0' || (entry->d_name[1] == '.' && entry->d_name[2] == '\0'))) {
+ while ((readdir_r(dir, &entry, &result) == 0) && (result != NULL)) {
+ if (result->d_name[0] == '.' &&
+ (result->d_name[1] == '\0'
+ || (result->d_name[1] == '.' && result->d_name[2] == '\0'))) {
continue;
}
- strncpy(ptr, entry->d_name, len);
+ strncpy(ptr, result->d_name, len);
ptr[len] = '\0';
fd = open(path, O_RDONLY);