diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-06-22 05:58:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-06-22 05:58:14 +0000 |
commit | 05ae4d6ad95c139aacbc16ed6b50a24678d01bf8 (patch) | |
tree | 1f1177f5fc84f9bd51c7966e1e3e36a044b3843b /dirent/bug-readdir1.c | |
parent | bff334e09023c8cf6327e9ff87b117f2331330d2 (diff) | |
download | glibc-05ae4d6ad95c139aacbc16ed6b50a24678d01bf8.zip glibc-05ae4d6ad95c139aacbc16ed6b50a24678d01bf8.tar.gz glibc-05ae4d6ad95c139aacbc16ed6b50a24678d01bf8.tar.bz2 |
Update.
2002-06-21 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/getdents.c [__ASSUME_GETDENTS64_SYSCALL]
(__GETDENTS): Check for failed getdents64 syscall.
* dirent/Makefile (tests): Add bug-readdir1.
* dirent/bug-readdir1.c: New file.
Diffstat (limited to 'dirent/bug-readdir1.c')
-rw-r--r-- | dirent/bug-readdir1.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/dirent/bug-readdir1.c b/dirent/bug-readdir1.c new file mode 100644 index 0000000..f9c609c --- /dev/null +++ b/dirent/bug-readdir1.c @@ -0,0 +1,36 @@ +#include <dirent.h> +#include <errno.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> + + +int +main (void) +{ + DIR *dirp; + struct dirent* ent; + + /* open a dir stream */ + dirp = opendir ("/tmp"); + if (dirp == NULL) + { + if (errno == ENOENT) + exit (0); + + perror ("opendir"); + exit (1); + } + + /* close the dir stream, making it invalid */ + if (closedir (dirp)) + { + perror ("closedir"); + exit (1); + } + + ent = readdir (dirp); + + return ent != NULL || errno != EBADF; +} |