add portable lchown (trivial to support and a few ancient things want it..)
authorRich Felker <dalias@aerifal.cx>
Fri, 18 Feb 2011 04:13:46 +0000 (23:13 -0500)
committerRich Felker <dalias@aerifal.cx>
Fri, 18 Feb 2011 04:13:46 +0000 (23:13 -0500)
include/sys/stat.h
src/stat/lchmod.c [new file with mode: 0644]

index 627890f44a89a12b233316be015301e246df8e97..25c199f9d3dab96670d04329c7828e5ba6bbc5ce 100644 (file)
@@ -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 (file)
index 0000000..c35f586
--- /dev/null
@@ -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);
+}