summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sys/stat.h3
-rw-r--r--src/stat/lchmod.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/include/sys/stat.h b/include/sys/stat.h
index 627890f4..25c199f9 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -86,6 +86,9 @@ int mkdirat(int, const char *, mode_t);
int mknodat(int, const char *, mode_t, dev_t);
int mkfifoat(int, const char *, mode_t);
+#ifdef _BSD_SOURCE
+int lchmod(const char *, mode_t);
+#endif
#ifdef __cplusplus
}
diff --git a/src/stat/lchmod.c b/src/stat/lchmod.c
new file mode 100644
index 00000000..c35f5861
--- /dev/null
+++ b/src/stat/lchmod.c
@@ -0,0 +1,7 @@
+#include <sys/stat.h>
+#include <fcntl.h>
+
+int lchmod(const char *path, mode_t mode)
+{
+ return fchmodat(AT_FDCWD, path, mode, AT_SYMLINK_NOFOLLOW);
+}