aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-09-28 22:38:36 +0000
committerUlrich Drepper <drepper@redhat.com>2005-09-28 22:38:36 +0000
commitdf811ccf028ee73a9affe643b5f0c3ac55ef2ae8 (patch)
tree7932c481f73a3368ade30c01658d649185fa8c16 /sysdeps
parent1812d50bc9ad034c8406f5e3de83b5a6c668f3a9 (diff)
downloadglibc-df811ccf028ee73a9affe643b5f0c3ac55ef2ae8.zip
glibc-df811ccf028ee73a9affe643b5f0c3ac55ef2ae8.tar.gz
glibc-df811ccf028ee73a9affe643b5f0c3ac55ef2ae8.tar.bz2
Close descriptor in case of error.
Diffstat (limited to 'sysdeps')
-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 fa55a24..3c481fc 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;
}