From 1bdffee820d92f558d883bd1aa41bebc739e2980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 10 Jan 2017 10:21:54 +0100 Subject: Prevent fd leak in readdir_r that causes false negative on readdir_r implementation when compiled with AddressSanitizer --- acinclude.m4 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'acinclude.m4') 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); } ],[ -- cgit v1.2.1