From 92c2e46b9663794c4585bf65f5e53d61638227aa Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 23 Apr 2001 09:04:59 +0000 Subject: (__pathconf): For _PC_ASYNC_IO test whether named file is a regular file or a block device. --- sysdeps/posix/pathconf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sysdeps/posix') diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c index 4ce5c0d1d7..63a3a9c511 100644 --- a/sysdeps/posix/pathconf.c +++ b/sysdeps/posix/pathconf.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -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 -- cgit 1.4.1