mirror of git://sourceware.org/git/glibc.git
(__pathconf): For _PC_ASYNC_IO test whether named file is a regular file or a block device.
This commit is contained in:
parent
77e4dc62b0
commit
92c2e46b96
|
|
@ -21,6 +21,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/statfs.h>
|
#include <sys/statfs.h>
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
|
|
||||||
|
|
@ -138,7 +139,16 @@ __pathconf (const char *path, int name)
|
||||||
|
|
||||||
case _PC_ASYNC_IO:
|
case _PC_ASYNC_IO:
|
||||||
#ifdef _POSIX_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
|
#else
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue