summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysdeps/unix/fdopendir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/unix/fdopendir.c b/sysdeps/unix/fdopendir.c
index fa55a24cb6..3c481fcf0d 100644
--- a/sysdeps/unix/fdopendir.c
+++ b/sysdeps/unix/fdopendir.c
@@ -20,6 +20,8 @@
#include <errno.h>
#include <sys/stat.h>
+#include <not-cancel.h>
+
DIR *
fdopendir (int fd)
@@ -27,10 +29,12 @@ fdopendir (int fd)
struct stat64 statbuf;
if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
- return NULL;
+ goto out;
if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
{
__set_errno (ENOTDIR);
+ out:
+ close_not_cancel_no_status (fd);
return NULL;
}