mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Better use of open in pathconf.
This commit is contained in:
@ -37,6 +37,7 @@ __pathconf (const char *file, int name)
|
|||||||
{
|
{
|
||||||
struct statfs fsbuf;
|
struct statfs fsbuf;
|
||||||
int fd;
|
int fd;
|
||||||
|
int flags;
|
||||||
|
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
@ -53,7 +54,11 @@ __pathconf (const char *file, int name)
|
|||||||
return __statfs_chown_restricted (__statfs (file, &fsbuf), &fsbuf);
|
return __statfs_chown_restricted (__statfs (file, &fsbuf), &fsbuf);
|
||||||
|
|
||||||
case _PC_PIPE_BUF:
|
case _PC_PIPE_BUF:
|
||||||
fd = open_not_cancel_2 (file, O_RDONLY|O_NONBLOCK);
|
flags = O_RDONLY|O_NONBLOCK|O_NOCTTY;
|
||||||
|
#ifdef O_CLOEXEC
|
||||||
|
flags |= O_CLOEXEC;
|
||||||
|
#endif
|
||||||
|
fd = open_not_cancel_2 (file, flags);
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
long int r = __fcntl (fd, F_GETPIPE_SZ);
|
long int r = __fcntl (fd, F_GETPIPE_SZ);
|
||||||
|
Reference in New Issue
Block a user