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) # ifndef HAVE_FCHOWN return chown(pathname, owner, group); # else +# ifdef O_NOFOLLOW if (flag & AT_SYMLINK_NOFOLLOW) oflags |= O_NOFOLLOW; +# endif /* O_NOFOLLOW */ if ((fd = open(path, oflags)) == -1) return -1; ret = fchown(fd, owner, group); @@ -203,8 +205,10 @@ fchmodat(int fd, const char *path, mode_t mode, int flag) # ifndef HAVE_FCHMOD return chown(pathname, owner, group); # else +# ifdef O_NOFOLLOW if (flag & AT_SYMLINK_NOFOLLOW) oflags |= O_NOFOLLOW; +# endif /* O_NOFOLLOW */ if ((fd = open(path, oflags)) == -1) return -1; ret = fchmod(fd, mode);