From 5fd3766e032ca6b3a712dab6b3e3f9bf9700ad22 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 29 Sep 2013 22:37:07 +0200 Subject: [PATCH] libroot_build: fs_darwin: fdopendir(): close FD on success fdopendir() is supposed to consume the specified FD on success. --- src/build/libroot/fs_darwin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/build/libroot/fs_darwin.cpp b/src/build/libroot/fs_darwin.cpp index f381bd0bdd..f4d11b690e 100644 --- a/src/build/libroot/fs_darwin.cpp +++ b/src/build/libroot/fs_darwin.cpp @@ -230,7 +230,11 @@ fdopendir(int fd) return NULL; } - return opendir(path); + DIR* dir = opendir(path); + if (dir != NULL) + close(fd); + + return dir; }