summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r--openbsd-compat/bsd-misc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 3c85a12a6..aa1c7d7a3 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -174,8 +174,10 @@ fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag)
174# ifndef HAVE_FCHOWN 174# ifndef HAVE_FCHOWN
175 return chown(pathname, owner, group); 175 return chown(pathname, owner, group);
176# else 176# else
177# ifdef O_NOFOLLOW
177 if (flag & AT_SYMLINK_NOFOLLOW) 178 if (flag & AT_SYMLINK_NOFOLLOW)
178 oflags |= O_NOFOLLOW; 179 oflags |= O_NOFOLLOW;
180# endif /* O_NOFOLLOW */
179 if ((fd = open(path, oflags)) == -1) 181 if ((fd = open(path, oflags)) == -1)
180 return -1; 182 return -1;
181 ret = fchown(fd, owner, group); 183 ret = fchown(fd, owner, group);
@@ -203,8 +205,10 @@ fchmodat(int fd, const char *path, mode_t mode, int flag)
203# ifndef HAVE_FCHMOD 205# ifndef HAVE_FCHMOD
204 return chown(pathname, owner, group); 206 return chown(pathname, owner, group);
205# else 207# else
208# ifdef O_NOFOLLOW
206 if (flag & AT_SYMLINK_NOFOLLOW) 209 if (flag & AT_SYMLINK_NOFOLLOW)
207 oflags |= O_NOFOLLOW; 210 oflags |= O_NOFOLLOW;
211# endif /* O_NOFOLLOW */
208 if ((fd = open(path, oflags)) == -1) 212 if ((fd = open(path, oflags)) == -1)
209 return -1; 213 return -1;
210 ret = fchmod(fd, mode); 214 ret = fchmod(fd, mode);