aboutsummaryrefslogtreecommitdiffstats
path: root/ports/unix/guts/fchmodat.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/unix/guts/fchmodat.c')
-rw-r--r--ports/unix/guts/fchmodat.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/ports/unix/guts/fchmodat.c b/ports/unix/guts/fchmodat.c
index 0506794..5a31151 100644
--- a/ports/unix/guts/fchmodat.c
+++ b/ports/unix/guts/fchmodat.c
@@ -2,6 +2,8 @@
* Copyright (c) 2008-2010, 2012, 2013 Wind River Systems; see
* guts/COPYRIGHT for information.
*
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
* static int
* wrap_fchmodat(int dirfd, const char *path, mode_t mode, int flags) {
* int rc = -1;
@@ -9,16 +11,16 @@
PSEUDO_STATBUF buf;
int save_errno = errno;
- if (flags & AT_SYMLINK_NOFOLLOW) {
- errno = ENOTSUP;
- return -1;
- }
#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
if (dirfd != AT_FDCWD) {
errno = ENOSYS;
return -1;
}
- rc = base_stat(path, &buf);
+ if (flags & AT_SYMLINK_NOFOLLOW) {
+ rc = base_lstat(path, &buf);
+ } else {
+ rc = base_stat(path, &buf);
+ }
#else
rc = base_fstatat(dirfd, path, &buf, flags);
#endif
@@ -26,9 +28,8 @@
return rc;
}
if (S_ISLNK(buf.st_mode)) {
- /* we don't really support chmod of a symlink */
- errno = ENOSYS;
- return -1;
+ /* according to docs, "chmod on a symbolic link always succeeds and has no effect" */
+ return 0;
}
save_errno = errno;