Ticket #10028: 0001-libroot_build-fs_darwin-fdopendir-close-FD-on-succes.patch

File 0001-libroot_build-fs_darwin-fdopendir-close-FD-on-succes.patch, 757 bytes (added by bonefish, 11 years ago)
  • src/build/libroot/fs_darwin.cpp

    From 7745119dc6dbe213caa75b69ffb8844e632a5172 Mon Sep 17 00:00:00 2001
    From: Ingo Weinhold <ingo_weinhold@gmx.de>
    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 f381bd0..f4d11b6 100644
    a b fdopendir(int fd)  
    230230        return NULL;
    231231    }
    232232
    233     return opendir(path);
     233    DIR* dir = opendir(path);
     234    if (dir != NULL)
     235        close(fd);
     236
     237    return dir;
    234238}
    235239
    236240