mirror of git://anongit.mindrot.org/openssh.git
Only use O_NOFOLLOW in fchownat and fchmodat if defined
This commit is contained in:
parent
342d6e5158
commit
43f47ebbdd
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue