From 0a0309380bea0008f1eca70a58796698211b156a Mon Sep 17 00:00:00 2001 From: cgf Date: Wed, 5 Dec 2001 23:05:13 +0000 Subject: [PATCH] * dir.cc (opendir): Detect error return from build_fhandler_from_name. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/dir.cc | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6484f164ca..3437a2cd2b 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2001-12-05 Christopher Faylor + + * dir.cc (opendir): Detect error return from build_fhandler_from_name. + 2001-12-04 David Rothenberger * net.cc (cygwin_getsockopt): Dereference optlen pointer when passing diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 07d2ce6d98..5713c57675 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -82,13 +82,18 @@ opendir (const char *name) { fhandler_base *fh; path_conv pc; - DIR *res = NULL; + DIR *res; fh = cygheap->fdtab.build_fhandler_from_name (-1, name, NULL, pc, PC_SYM_FOLLOW | PC_FULL, NULL); - res = fh->opendir (pc); - if (!res) - delete fh; + if (!fh) + res = NULL; + else + { + res = fh->opendir (pc); + if (!res) + delete fh; + } return res; } -- 2.11.0