From d755bba40f880c01ced8740a26fecc85534454b9 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 3 Apr 2013 10:56:45 +0530 Subject: Preserve errno across _PC_CHOWN_RESTRICTED call on XFS Fix BZ #15305. On kernel versions earlier than 2.6.29, the Linux kernel exported a sysctl called restrict_chown for xfs, which could be used to allow chown to users other than the owner. 2.6.29 removed this support, causing the open_not_cancel_2 to fail and thus modify errno. The fix is to save and restore errno so that the caller sees it as unmodified. Additionally, since the code to check the sysctl is not useful on newer kernels, we add an ifdef so that in future the code block gets rmeoved completely. --- sysdeps/unix/sysv/linux/kernel-features.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sysdeps/unix/sysv/linux/kernel-features.h') diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 8fdff7e381..ccd4c5918b 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -221,3 +221,9 @@ #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100 # define __ASSUME_GETCPU_SYSCALL 1 #endif + +/* 2.6.29 removed the XFS restricted_chown sysctl, so it is pointless looking + for it in newer kernels. */ +#if __LINUX_KERNEL_VERSION >= 0x02061d +# define __ASSUME_XFS_RESTRICTED_CHOWN 1 +#endif -- cgit v1.2.3