From: Todd C. Miller Date: Wed, 20 Jan 2016 02:50:27 +0000 (-0700) Subject: There are no systems that support O_SEARCH/O_PATH that do not also X-Git-Tag: SUDO_1_8_16^2~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e300f1e4c0d0ae407bac6393d1bbdcc9d640334;p=sudo There are no systems that support O_SEARCH/O_PATH that do not also support O_DIRECTORY so simplify the definition of DIR_OPEN_FLAGS a bit. --- diff --git a/src/sudo_edit.c b/src/sudo_edit.c index c63d4b603..15abf1183 100644 --- a/src/sudo_edit.c +++ b/src/sudo_edit.c @@ -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