aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-12-05 23:07:06 +0000
committerChristopher Faylor <me@cgf.cx>2001-12-05 23:07:06 +0000
commit1bd502a92065365d81984c007fefcd98ae4e9c08 (patch)
treeb06d643bb0d89f06499219adc55fc17836b46879
parentf53fc6544ad738739e0372ae41b4ab4fe73e5c47 (diff)
downloadnewlib-github/unlabeled-1.53.6.zip
newlib-github/unlabeled-1.53.6.tar.gz
newlib-github/unlabeled-1.53.6.tar.bz2
* dir.cc (opendir): Detect error return from build_fhandler_from_name.github/unlabeled-1.53.6unlabeled-1.53.6
-rw-r--r--winsup/cygwin/dir.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index 07d2ce6..5713c57 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;
}