diff options
author | Hyeongsik Min <hyeongsik.min@samsung.com> | 2016-12-27 16:25:19 +0900 |
---|---|---|
committer | Hyeongsik Min <hyeongsik.min@samsung.com> | 2016-12-27 20:24:18 +0900 |
commit | 6372bf3677c216ce8dd4dad90c51a6f2bff17f12 (patch) | |
tree | 5a5570744617932eb0f37934f05862fae938ecbc /sysdeps/linux-gnu/proc.c | |
parent | 004a8b4fd3e6c6c592aba8dbafde5516c7bc1bef (diff) | |
download | ltrace-accepted/tizen/4.0/unified/20170816.014018.tar.gz ltrace-accepted/tizen/4.0/unified/20170816.014018.tar.bz2 ltrace-accepted/tizen/4.0/unified/20170816.014018.zip |
Replace readdir_r with readdirtizen_5.5.m2_releasetizen_4.0.m2_releasetizen_4.0.m1_releasetizen_4.0.IoT.p2_releasetizen_4.0.IoT.p1_releasesubmit/tizen_unified/20170308.100415submit/tizen_5.5_wearable_hotfix/20201026.184307submit/tizen_5.5_mobile_hotfix/20201026.185107submit/tizen_5.5/20191031.000007submit/tizen_5.0/20181101.000007submit/tizen_4.0/20170828.100006submit/tizen_4.0/20170811.094300submit/tizen/20161227.115415accepted/tizen/wearable/20161228.083532accepted/tizen/unified/20170309.040228accepted/tizen/tv/20161228.083512accepted/tizen/mobile/20161228.083453accepted/tizen/ivi/20161228.083548accepted/tizen/common/20161227.192631accepted/tizen/5.5/unified/wearable/hotfix/20201027.100550accepted/tizen/5.5/unified/mobile/hotfix/20201027.074237accepted/tizen/5.5/unified/20191031.011812accepted/tizen/5.0/unified/20181102.030449accepted/tizen/4.0/unified/20170828.222850accepted/tizen/4.0/unified/20170816.014018tizen_5.5_wearable_hotfixtizen_5.5_tvtizen_5.5_mobile_hotfixtizen_5.5tizen_5.0tizen_4.0sandbox/dnxowls/rpm_upgradeaccepted/tizen_wearableaccepted/tizen_tvaccepted/tizen_mobileaccepted/tizen_iviaccepted/tizen_commonaccepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified_mobile_hotfixaccepted/tizen_5.5_unifiedaccepted/tizen_5.0_unifiedaccepted/tizen_4.0_unified
Change-Id: I1a6c75d8a2f64e58a4c81724e2c3b0568b581a7b
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
Diffstat (limited to 'sysdeps/linux-gnu/proc.c')
-rw-r--r-- | sysdeps/linux-gnu/proc.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c index 953fd86..d17510d 100644 --- a/sysdeps/linux-gnu/proc.c +++ b/sysdeps/linux-gnu/proc.c @@ -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); |