From: Paul Eggert Date: Sun, 3 Oct 2021 18:42:20 +0000 (-0700) Subject: Simplify socket symlink-attack checking X-Git-Tag: emacs-28.0.90~436 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=732c70a0d9;p=emacs.git Simplify socket symlink-attack checking This is a minor bugfix cleanup (Bug#33847#161). * lib-src/emacsclient.c: Move "#include " to inside "#ifdef SOCKETS_IN_FILE_SYSTEM", which is more accurate and simpler than having a separate "#ifndef WINDOWSNT". (O_PATH): Likewise. --- diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 018e81e4222..cff3cec2a79 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -80,9 +80,6 @@ char *w32_getenv (const char *); #include #include -#ifndef WINDOWSNT -# include -#endif #include #include #include @@ -94,10 +91,6 @@ char *w32_getenv (const char *); # pragma GCC diagnostic ignored "-Wformat-truncation=2" #endif -#if !defined O_PATH && !defined WINDOWSNT -# define O_PATH O_SEARCH -#endif - /* Name used to invoke this program. */ static char const *progname; @@ -1135,6 +1128,12 @@ process_grouping (void) #ifdef SOCKETS_IN_FILE_SYSTEM +# include + +# ifndef O_PATH +# define O_PATH O_SEARCH +# endif + /* A local socket address. The union avoids the need to cast. */ union local_sockaddr {