Replace readdir_r with readdir 11/107311/1 accepted/tizen_4.0_unified accepted/tizen_5.0_unified accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable sandbox/dnxowls/rpm_upgrade tizen_4.0 tizen_5.0 tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/4.0/unified/20170816.014018 accepted/tizen/4.0/unified/20170828.222850 accepted/tizen/5.0/unified/20181102.030449 accepted/tizen/5.5/unified/20191031.011812 accepted/tizen/5.5/unified/mobile/hotfix/20201027.074237 accepted/tizen/5.5/unified/wearable/hotfix/20201027.100550 accepted/tizen/common/20161227.192631 accepted/tizen/ivi/20161228.083548 accepted/tizen/mobile/20161228.083453 accepted/tizen/tv/20161228.083512 accepted/tizen/unified/20170309.040228 accepted/tizen/wearable/20161228.083532 submit/tizen/20161227.115415 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170828.100006 submit/tizen_5.0/20181101.000007 submit/tizen_5.5/20191031.000007 submit/tizen_5.5_mobile_hotfix/20201026.185107 submit/tizen_5.5_wearable_hotfix/20201026.184307 submit/tizen_unified/20170308.100415 tizen_4.0.IoT.p1_release tizen_4.0.IoT.p2_release tizen_4.0.m1_release tizen_4.0.m2_release tizen_5.5.m2_release
authorHyeongsik Min <hyeongsik.min@samsung.com>
Tue, 27 Dec 2016 07:25:19 +0000 (16:25 +0900)
committerHyeongsik Min <hyeongsik.min@samsung.com>
Tue, 27 Dec 2016 11:24:18 +0000 (20:24 +0900)
Change-Id: I1a6c75d8a2f64e58a4c81724e2c3b0568b581a7b
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
sysdeps/linux-gnu/proc.c

index 953fd86..d17510d 100644 (file)
@@ -242,14 +242,8 @@ process_tasks(pid_t pid, pid_t **ret_tasks, size_t *ret_n)
        size_t alloc = 0;
 
        while (1) {
-               struct dirent entry;
                struct dirent *result;
-               if (readdir_r(d, &entry, &result) != 0) {
-               fail:
-                       free(tasks);
-                       closedir(d);
-                       return -1;
-               }
+               result = readdir(d);
                if (result == NULL)
                        break;
                if (result->d_type == DT_DIR && all_digits(result->d_name)) {
@@ -258,8 +252,11 @@ process_tasks(pid_t pid, pid_t **ret_tasks, size_t *ret_n)
                                alloc = alloc > 0 ? (2 * alloc) : 8;
                                pid_t *ntasks = realloc(tasks,
                                                        sizeof(*tasks) * alloc);
-                               if (ntasks == NULL)
-                                       goto fail;
+                               if (ntasks == NULL) {
+                                       free(tasks);
+                                       closedir(d);
+                                       return -1;
+                               }
                                tasks = ntasks;
                        }
                        assert(n < alloc);