aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix/fpathconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix/fpathconf.c')
-rw-r--r--sysdeps/posix/fpathconf.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sysdeps/posix/fpathconf.c b/sysdeps/posix/fpathconf.c
index 1a2c3742e9..31e1d4bbfa 100644
--- a/sysdeps/posix/fpathconf.c
+++ b/sysdeps/posix/fpathconf.c
@@ -45,7 +45,6 @@ __fpathconf (fd, name)
#ifdef LINK_MAX
return LINK_MAX;
#else
- __set_errno (ENOSYS);
return -1;
#endif
@@ -53,7 +52,6 @@ __fpathconf (fd, name)
#ifdef MAX_CANON
return MAX_CANON;
#else
- __set_errno (ENOSYS);
return -1;
#endif
@@ -61,7 +59,6 @@ __fpathconf (fd, name)
#ifdef MAX_INPUT
return MAX_INPUT;
#else
- __set_errno (ENOSYS);
return -1;
#endif
@@ -69,14 +66,21 @@ __fpathconf (fd, name)
#ifdef NAME_MAX
{
struct statfs buf;
+ int save_errno = errno;
if (__fstatfs (fd, &buf) < 0)
- return errno == ENOSYS ? NAME_MAX : -1;
+ {
+ if (errno == ENOSYS)
+ {
+ errno = save_errno;
+ return NAME_MAX;
+ }
+ return -1;
+ }
else
return buf.f_namelen;
}
#else
- __set_errno (ENOSYS);
return -1;
#endif
@@ -84,7 +88,6 @@ __fpathconf (fd, name)
#ifdef PATH_MAX
return PATH_MAX;
#else
- __set_errno (ENOSYS);
return -1;
#endif
@@ -92,7 +95,6 @@ __fpathconf (fd, name)
#ifdef PIPE_BUF
return PIPE_BUF;
#else
- __set_errno (ENOSYS);
return -1;
#endif
@@ -142,13 +144,9 @@ __fpathconf (fd, name)
#ifdef SOCK_MAXBUF
return SOCK_MAXBUF;
#else
- __set_errno (ENOSYS);
return -1;
#endif
}
-
- __set_errno (ENOSYS);
- return -1;
}
weak_alias (__fpathconf, fpathconf)