Replace 'readdir_r' with 'readdir' 36/104736/2 accepted/tizen/common/20161219.151825 accepted/tizen/ivi/20161219.021751 accepted/tizen/mobile/20161219.021605 accepted/tizen/tv/20161219.021650 accepted/tizen/wearable/20161219.021722 submit/tizen/20161216.095153
authorInkyun Kil <inkyun.kil@samsung.com>
Wed, 14 Dec 2016 07:44:21 +0000 (16:44 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Wed, 14 Dec 2016 07:50:47 +0000 (16:50 +0900)
'readdir_r' is deprecated since version 2.24 glibc.
By upgrading TOOLCHAIN for platform, it should be replaced by 'readdir'

Change-Id: Iaa2b9a03a4e5a393436516ea87ce9d7b2559716e
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
src/miregex.c

index 9efc06d..20e29fd 100644 (file)
@@ -198,8 +198,7 @@ static void __miregex_free_regex_table()
 regex_tbl *miregex_get_regex_table()
 {
        DIR *dp;
-       struct dirent dentry;
-       struct dirent *result = NULL;
+       struct dirent *dentry = NULL;
        char buf[MAX_LOCAL_BUFSZ];
        miregex_file_info *info;
 
@@ -215,17 +214,18 @@ regex_tbl *miregex_get_regex_table()
        if (dp == NULL)
                return NULL;
 
-       while (readdir_r(dp, &dentry, &result) == 0 && result != NULL) {
-               if (dentry.d_name[0] == '.')
+       while ((dentry = readdir(dp)) != NULL) {
+               if (dentry->d_name[0] == '.')
                        continue;
 
                snprintf(buf, sizeof(buf), "%s/%s", MIREGEX_DIR,
-                        dentry.d_name);
+                        dentry->d_name);
+
                info = __get_miregex_file_info(buf);
                if (info == NULL)
                        continue;
 
-               if (__add_miregex(dentry.d_name,
+               if (__add_miregex(dentry->d_name,
                        info->regex, info->desc) < 0) {
                        /* TODO : invalid regular expression - will be removed*/
                }