diff options
author | SukHyung, Kang <shine.kang@samsung.com> | 2016-03-18 10:33:24 +0900 |
---|---|---|
committer | SukHyung, Kang <shine.kang@samsung.com> | 2016-03-18 16:48:59 +0900 |
commit | a8d4aef955a5afaaacea03c0cd495298eda08ed9 (patch) | |
tree | 054a2ebb7016e2308177b9947adab9a4a9d94cd8 | |
parent | 58d34a7388c3c5b5c116c54c28abda28f826e3bb (diff) | |
download | widget-service-a8d4aef955a5afaaacea03c0cd495298eda08ed9.tar.gz widget-service-a8d4aef955a5afaaacea03c0cd495298eda08ed9.tar.bz2 widget-service-a8d4aef955a5afaaacea03c0cd495298eda08ed9.zip |
Use thread-safe functionssubmit/tizen_ivi/20160322.020156submit/tizen/20160318.074817accepted/tizen/wearable/20160321.004559accepted/tizen/tv/20160321.004540accepted/tizen/mobile/20160321.004519accepted/tizen/ivi/20160322.023146accepted/tizen/ivi/20160321.004618accepted/tizen/common/20160321.145922
Change-Id: I2011ebc0bf534098f2732ab05d65d2bc12d1253c
Signed-off-by: SukHyung, Kang <shine.kang@samsung.com>
-rw-r--r-- | src/widget_conf.c | 12 |
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); |