summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-01-11 13:32:47 +0000
committerJim Meyering <jim@meyering.net>2006-01-11 13:32:47 +0000
commit0e42486491db45d5f7d7e4443c476e150c70dd9d (patch)
treee14cdc0256d720d24934f7d8f620cebc2ae78ded
parent9cbd6c03665e0d531215e957710becb71e5e6a7b (diff)
downloadcoreutils-0e42486491db45d5f7d7e4443c476e150c70dd9d.tar.xz
(fchmodat, fchownat): Declare.
(chmodat, lchmodat): Define convenience functions. (chownat, lchownat): Likewise.
-rw-r--r--lib/openat.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/openat.h b/lib/openat.h
index 15b1d9df8..aaa2801bc 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -1,5 +1,5 @@
/* provide a replacement openat function
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -72,3 +72,32 @@ int unlinkat (int fd, char const *file, int flag);
int mkdirat (int fd, char const *file, mode_t mode);
void openat_restore_fail (int) ATTRIBUTE_NORETURN;
void openat_save_fail (int) ATTRIBUTE_NORETURN;
+int fchmodat (int fd, char const *file, mode_t mode, int flag);
+int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag);
+
+/* Using these function names makes application code
+ slightly more readable than it would be with
+ fchownat (..., 0) or fchownat (..., AT_SYMLINK_NOFOLLOW). */
+static inline int
+chownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+ return fchownat (fd, file, owner, group, 0);
+}
+
+static inline int
+lchownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+ return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW);
+}
+
+static inline int
+chmodat (int fd, char const *file, mode_t mode)
+{
+ return fchmodat (fd, file, mode, 0);
+}
+
+static inline int
+lchmodat (int fd, char const *file, mode_t mode)
+{
+ return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
+}