summaryrefslogtreecommitdiff
path: root/src/unistd/chown.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd/chown.c')
-rw-r--r--src/unistd/chown.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/unistd/chown.c b/src/unistd/chown.c
new file mode 100644
index 0000000..14b0325
--- /dev/null
+++ b/src/unistd/chown.c
@@ -0,0 +1,12 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include "syscall.h"
+
+int chown(const char *path, uid_t uid, gid_t gid)
+{
+#ifdef SYS_chown
+ return syscall(SYS_chown, path, uid, gid);
+#else
+ return syscall(SYS_fchownat, AT_FDCWD, path, uid, gid, 0);
+#endif
+}