]> granicus.if.org Git - sudo/commitdiff
No need to check whether the fd we opened is really a directory in
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 11 Jan 2016 18:15:42 +0000 (11:15 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 11 Jan 2016 18:15:42 +0000 (11:15 -0700)
sudo_edit_open_nonwritable() since if not, the openat() will fail
with ENOTDIR anyway.

src/sudo_edit.c

index ce060d9721e1c3352a5798df201c87a7c0b603d8..c09d793544338a94506c50e7a45c9a4548b6ade7 100644 (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);