Replace 'readdir_r' with 'readdir' 26/104926/1 accepted/tizen/common/20161219.151814 accepted/tizen/ivi/20161219.021738 accepted/tizen/mobile/20161219.021544 accepted/tizen/tv/20161219.021633 accepted/tizen/wearable/20161219.021706 submit/tizen/20161216.095153
authorInkyun Kil <inkyun.kil@samsung.com>
Thu, 15 Dec 2016 00:24:06 +0000 (09:24 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Thu, 15 Dec 2016 00:27:51 +0000 (09:27 +0900)
'readdir_r' is deprecated since version 2.24 glibc.
By upgrading TOOLCHAIN for platform, it should be replaced by 'readdir'

Change-Id: I54ad1b8291f5148e2e294cb8219ce11b32f1db6c
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
src/debugger_info.c
src/launcher_info.c
src/launchpad_common.c
src/launchpad_signal.c
src/loader_info.c

index 4af4a2d..1ba596b 100644 (file)
@@ -190,8 +190,7 @@ static GList *__parse_file(GList *list, const char *path)
 GList *_debugger_info_load(const char *path)
 {
        DIR *dp;
-       struct dirent dentry;
-       struct dirent *result = NULL;
+       struct dirent *dentry = NULL;
        GList *list = NULL;
        char buf[PATH_MAX];
        char *ext;
@@ -203,14 +202,14 @@ GList *_debugger_info_load(const char *path)
        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;
 
-               ext = strrchr(dentry.d_name, '.');
+               ext = strrchr(dentry->d_name, '.');
                if (ext && strcmp(ext, ".debugger") == 0) {
                        snprintf(buf, sizeof(buf), "%s/%s",
-                                       path, dentry.d_name);
+                                       path, dentry->d_name);
                        list = __parse_file(list, buf);
                }
        }
index 06b46ab..bff7a12 100644 (file)
@@ -169,8 +169,7 @@ static GList *__parse_file(GList *list, const char *path)
 GList *_launcher_info_load(const char *path)
 {
        DIR *dp;
-       struct dirent dentry;
-       struct dirent *result = NULL;
+       struct dirent *dentry = NULL;
        GList *list = NULL;
        char buf[PATH_MAX];
        char *ext;
@@ -182,14 +181,14 @@ GList *_launcher_info_load(const char *path)
        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;
 
-               ext = strrchr(dentry.d_name, '.');
+               ext = strrchr(dentry->d_name, '.');
                if (ext && strcmp(ext, ".launcher") == 0) {
                        snprintf(buf, sizeof(buf), "%s/%s",
-                                       path, dentry.d_name);
+                                       path, dentry->d_name);
                        list = __parse_file(list, buf);
                }
        }
index aa4b909..dbfbee4 100644 (file)
@@ -659,8 +659,7 @@ int _proc_get_attr_by_pid(int pid, char *buf, int size)
 static int __delete_dir(const char *path)
 {
        DIR *dp;
-       struct dirent dentry;
-       struct dirent *result = NULL;
+       struct dirent *dentry = NULL;
        char buf[PATH_MAX];
        struct stat statbuf;
        int ret;
@@ -672,11 +671,11 @@ static int __delete_dir(const char *path)
        if (dp == NULL)
                return -1;
 
-       while (readdir_r(dp, &dentry, &result) == 0 && result) {
-               if (!strcmp(dentry.d_name, ".") || !strcmp(dentry.d_name, ".."))
+       while ((dentry = readdir(dp)) != NULL) {
+               if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, ".."))
                        continue;
 
-               snprintf(buf, sizeof(buf), "%s/%s", path, dentry.d_name);
+               snprintf(buf, sizeof(buf), "%s/%s", path, dentry->d_name);
                ret = stat(buf, &statbuf);
                if (ret == 0) {
                        if (S_ISDIR(statbuf.st_mode))
@@ -709,8 +708,7 @@ int _delete_sock_path(int pid, uid_t uid)
 int _close_all_fds(void)
 {
        DIR *dp;
-       struct dirent dentry;
-       struct dirent *result = NULL;
+       struct dirent *dentry = NULL;
        int fd;
        int max_fd;
 
@@ -724,11 +722,11 @@ int _close_all_fds(void)
                return 0;
        }
 
-       while (readdir_r(dp, &dentry, &result) == 0 && result) {
-               if (!isdigit(dentry.d_name[0]))
+       while ((dentry = readdir(dp)) != NULL) {
+               if (!isdigit(dentry->d_name[0]))
                        continue;
 
-               fd = atoi(dentry.d_name);
+               fd = atoi(dentry->d_name);
                if (fd < 3)
                        continue;
 
index e802ca4..1742dcf 100644 (file)
@@ -127,7 +127,7 @@ static gboolean __flush_pending_signal(gpointer data)
 static void __socket_garbage_collector(void)
 {
        DIR *dp;
-       struct dirent *dentry;
+       struct dirent *dentry = NULL;
        char tmp[MAX_LOCAL_BUFSZ];
 
        snprintf(tmp, sizeof(tmp), "/run/aul/apps/%d", getuid());
index c0ded9f..c4ac48c 100644 (file)
@@ -225,8 +225,7 @@ static GList *__parse_file(GList *list, const char *path)
 GList *_loader_info_load(const char *path)
 {
        DIR *dir_info;
-       struct dirent entry;
-       struct dirent *result = NULL;
+       struct dirent *entry = NULL;
        GList *list = NULL;
        char buf[PATH_MAX];
        char *ext;
@@ -235,12 +234,12 @@ GList *_loader_info_load(const char *path)
        if (dir_info == NULL)
                return  NULL;
 
-       while (readdir_r(dir_info, &entry, &result) == 0 && result != NULL) {
-               if (entry.d_name[0] == '.')
+       while ((entry = readdir(dir_info)) != NULL) {
+               if (entry->d_name[0] == '.')
                        continue;
-               ext = strrchr(entry.d_name, '.');
+               ext = strrchr(entry->d_name, '.');
                if (ext && !strcmp(ext, ".loader")) {
-                       snprintf(buf, sizeof(buf), "%s/%s", path, entry.d_name);
+                       snprintf(buf, sizeof(buf), "%s/%s", path, entry->d_name);
                        list = __parse_file(list, buf);
                }
        }