aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-23 09:04:59 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-23 09:04:59 +0000
commit92c2e46b9663794c4585bf65f5e53d61638227aa (patch)
treea6bea2e4391c76ebb04f68dc4d1b2380bb1cbac6 /sysdeps/posix
parent77e4dc62b0b8aab2ed44866aee00b4063ffb8ce8 (diff)
downloadglibc-92c2e46b9663794c4585bf65f5e53d61638227aa.zip
glibc-92c2e46b9663794c4585bf65f5e53d61638227aa.tar.gz
glibc-92c2e46b9663794c4585bf65f5e53d61638227aa.tar.bz2
(__pathconf): For _PC_ASYNC_IO test whether named file is a regular file or a block device.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/pathconf.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c
index 4ce5c0d..63a3a9c 100644
--- a/sysdeps/posix/pathconf.c
+++ b/sysdeps/posix/pathconf.c
@@ -21,6 +21,7 @@
#include <unistd.h>
#include <limits.h>
#include <fcntl.h>
+#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/statvfs.h>
@@ -138,7 +139,16 @@ __pathconf (const char *path, int name)
case _PC_ASYNC_IO:
#ifdef _POSIX_ASYNC_IO
- return _POSIX_ASYNC_IO;
+ {
+ /* AIO is only allowed on regular files and block devices. */
+ struct stat64 st;
+
+ if (__xstat64 (_STAT_VER, path, &st) < 0
+ || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
+ return -1;
+ else
+ return 1;
+ }
#else
return -1;
#endif