summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2017-01-10 10:21:54 +0100
committerJoe Watkins <krakjoe@php.net>2017-01-10 11:51:27 +0000
commit1bdffee820d92f558d883bd1aa41bebc739e2980 (patch)
tree12d301f29d86e5a04ae3067897df9cbce3ae423c /acinclude.m4
parent125ee6a68e40d539cac5eb97def04d1586ce0e5d (diff)
downloadphp-git-1bdffee820d92f558d883bd1aa41bebc739e2980.tar.gz
Prevent fd leak in readdir_r that causes false negative on readdir_r implementation when compiled with AddressSanitizer
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m45
1 files changed, 4 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 234dcd7ef8..36bd1c22e5 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1376,8 +1376,11 @@ main() {
dir = opendir("/");
if (!dir)
exit(1);
- if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
+ if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) {
+ close(dir);
exit(0);
+ }
+ close(dir);
exit(1);
}
],[