From 82cab378652c1d1601545a80b7241090c55b1e37 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Wed, 10 Oct 2012 13:41:18 +0100 Subject: chmod: Use fchmodat if arch does not have the chmod syscall Signed-off-by: Markos Chandras Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/chmod.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libc/sysdeps/linux/common/chmod.c') diff --git a/libc/sysdeps/linux/common/chmod.c b/libc/sysdeps/linux/common/chmod.c index 871e0233d..494ec666a 100644 --- a/libc/sysdeps/linux/common/chmod.c +++ b/libc/sysdeps/linux/common/chmod.c @@ -9,13 +9,22 @@ #include #include +#include +#if defined __NR_fchmodat && !defined __NR_chmod +# include +int chmod(const char *path, mode_t mode) +{ + return fchmodat(AT_FDCWD, path, mode, 0); +} -#define __NR___syscall_chmod __NR_chmod +#else +# define __NR___syscall_chmod __NR_chmod static __inline__ _syscall2(int, __syscall_chmod, const char *, path, __kernel_mode_t, mode) int chmod(const char *path, mode_t mode) { return __syscall_chmod(path, mode); } +#endif libc_hidden_def(chmod) -- cgit v1.2.3