]> granicus.if.org Git - sudo/commitdiff
There are no systems that support O_SEARCH/O_PATH that do not also
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 20 Jan 2016 02:50:27 +0000 (19:50 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 20 Jan 2016 02:50:27 +0000 (19:50 -0700)
support O_DIRECTORY so simplify the definition of DIR_OPEN_FLAGS a
bit.

src/sudo_edit.c

index c63d4b60345da45d3929447e831af3e9be03602c..15abf118317af091fee4a88f48d0aaaad0bfd65c 100644 (file)
@@ -344,24 +344,16 @@ dir_is_writable(int dfd, struct user_details *ud, struct command_details *cd)
 
 /*
  * Directory open flags for use with openat(2).
- * Use O_PATH/O_SEARCH and O_DIRECTORY where possible.
+ * Use O_SEARCH/O_PATH and/or O_DIRECTORY where possible.
  */
-#if defined(O_PATH)
-# if defined(O_DIRECTORY)
-#  define DIR_OPEN_FLAGS       (O_PATH|O_DIRECTORY)
-# else
-#  define DIR_OPEN_FLAGS       (O_PATH)
-# endif
-#elif defined(O_SEARCH)
-# if defined(O_DIRECTORY)
-#  define DIR_OPEN_FLAGS       (O_SEARCH|O_DIRECTORY)
-# else
-#  define DIR_OPEN_FLAGS       (O_SEARCH)
-# endif
+#if defined(O_SEARCH)
+# define DIR_OPEN_FLAGS        (O_SEARCH|O_DIRECTORY)
+#elif defined(O_PATH)
+# define DIR_OPEN_FLAGS        (O_PATH|O_DIRECTORY)
 #elif defined(O_DIRECTORY)
-# define DIR_OPEN_FLAGS                (O_RDONLY|O_DIRECTORY)
+# define DIR_OPEN_FLAGS        (O_RDONLY|O_DIRECTORY)
 #else
-# define DIR_OPEN_FLAGS                (O_RDONLY|O_NONBLOCK)
+# define DIR_OPEN_FLAGS        (O_RDONLY|O_NONBLOCK)
 #endif
 
 static int