From: Markos Chandras <markos.chand...@imgtec.com> Signed-off-by: Markos Chandras <markos.chand...@imgtec.com> --- include/unistd.h | 1 + libc/sysdeps/linux/common/chown.c | 9 +++++++++ libc/sysdeps/linux/common/fchownat.c | 1 + 3 files changed, 11 insertions(+)
diff --git a/include/unistd.h b/include/unistd.h index c17de33..4149811 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -518,6 +518,7 @@ extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) extern int fchownat (int __fd, const char *__file, __uid_t __owner, __gid_t __group, int __flag) __THROW __nonnull ((2)) __wur; +libc_hidden_proto(fchownat) #endif /* Use GNU. */ /* Change the process's working directory to PATH. */ diff --git a/libc/sysdeps/linux/common/chown.c b/libc/sysdeps/linux/common/chown.c index f2c60e0..edca3f8 100644 --- a/libc/sysdeps/linux/common/chown.c +++ b/libc/sysdeps/linux/common/chown.c @@ -8,9 +8,17 @@ */ #include <sys/syscall.h> +#include <fcntl.h> #include <unistd.h> #include <bits/wordsize.h> +#if defined(__NR_fchownat) && !defined(__NR_chown) +int chown(const char *path, uid_t owner, gid_t group) +{ + return fchownat(AT_FDCWD, path, owner, group, 0); +} + +#else #if (__WORDSIZE == 32 && defined(__NR_chown32)) || __WORDSIZE == 64 # ifdef __NR_chown32 @@ -37,4 +45,5 @@ int chown(const char *path, uid_t owner, gid_t group) } #endif +#endif libc_hidden_def(chown) diff --git a/libc/sysdeps/linux/common/fchownat.c b/libc/sysdeps/linux/common/fchownat.c index 707164d..4ad818b 100644 --- a/libc/sysdeps/linux/common/fchownat.c +++ b/libc/sysdeps/linux/common/fchownat.c @@ -11,6 +11,7 @@ #ifdef __NR_fchownat _syscall5(int, fchownat, int, fd, const char *, file, uid_t, owner, gid_t, group, int, flag) +libc_hidden_def(fchownat) #else /* should add emulation with fchown() and /proc/self/fd/ ... */ #endif -- 1.8.1.1 _______________________________________________ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc