aboutsummaryrefslogtreecommitdiff
path: root/io/lchmod.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-01-22 18:56:04 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-02-12 08:43:59 +0100
commit6b89c385d8bd0700b25bac2c2d0bebe68d5cc05d (patch)
tree9daf6ad81d41930593a0ed2a3c027d52a9bcf05d /io/lchmod.c
parent6c80c6e8767b860a5e18e136d04a80be2a8dce15 (diff)
downloadglibc-6b89c385d8bd0700b25bac2c2d0bebe68d5cc05d.tar
glibc-6b89c385d8bd0700b25bac2c2d0bebe68d5cc05d.tar.gz
glibc-6b89c385d8bd0700b25bac2c2d0bebe68d5cc05d.tar.bz2
glibc-6b89c385d8bd0700b25bac2c2d0bebe68d5cc05d.zip
io: Implement lchmod using fchmodat [BZ #14578]
Diffstat (limited to 'io/lchmod.c')
-rw-r--r--io/lchmod.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/io/lchmod.c b/io/lchmod.c
index 90b33a49f9..8b788034ee 100644
--- a/io/lchmod.c
+++ b/io/lchmod.c
@@ -1,4 +1,4 @@
-/* lchmod -- Change the protections of a file or symbolic link. Stub version.
+/* lchmod -- Change the protections of a file or symbolic link. Generic version.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -17,15 +17,13 @@
<https://www.gnu.org/licenses/>. */
#include <errno.h>
-#include <sys/stat.h>
+#include <fcntl.h>
#include <sys/types.h>
+#include <unistd.h>
/* Change the protections of FILE to MODE. */
int
lchmod (const char *file, mode_t mode)
{
- __set_errno (ENOSYS);
- return -1;
+ return fchmodat (AT_FDCWD, file, mode, AT_SYMLINK_NOFOLLOW);
}
-
-stub_warning (lchmod)