about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c')
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c
index d927d7ca0d..abc06b07d9 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c
@@ -53,6 +53,24 @@ extern int __libc_missing_32bit_uids;
 int
 fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
 {
+  int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
   if (flag & ~AT_SYMLINK_NOFOLLOW)
     {
       __set_errno (EINVAL);
@@ -79,16 +97,15 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
       file = buf;
     }
 
-  int result;
   INTERNAL_SYSCALL_DECL (err);
 
-#if __ASSUME_32BITUIDS > 0
+# if __ASSUME_32BITUIDS > 0
   result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file), owner,
 			     group);
-#else
+# else
   static int __libc_old_chown;
 
-# ifdef __NR_chown32
+#  ifdef __NR_chown32
   if (__libc_missing_32bit_uids <= 0)
     {
       if (flag & AT_SYMLINK_NOFOLLOW)
@@ -105,7 +122,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
 
       __libc_missing_32bit_uids = 1;
     }
-# endif /* __NR_chown32 */
+#  endif /* __NR_chown32 */
   if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
       || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
     {
@@ -128,7 +145,7 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
 
   result = INTERNAL_SYSCALL (lchown, err, 3, CHECK_STRING (file), owner,
 			     group);
-#endif
+# endif
 
   if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
     {
@@ -138,4 +155,5 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
     }
 
   return result;
+#endif
 }