No need to check whether the fd we opened is really a directory in

sudo_edit_open_nonwritable() since if not, the openat() will fail
with ENOTDIR anyway.
This commit is contained in:
Todd C. Miller
2016-01-11 11:15:42 -07:00
parent 68c1073fe5
commit c7c80913ef

View File

@@ -364,13 +364,7 @@ restart:
#endif
debug_return_int(-1);
}
#ifndef O_DIRECTORY
if (!S_ISDIR(sb.st_mode)) {
close(dfd);
errno = ENOTDIR;
debug_return_int(-1);
}
#endif
is_writable = dir_is_writable(&sb, user_details.uid, user_details.gid,
user_details.ngroups, user_details.groups);