From 979edbb953c834027716a3ceeba7bee1bf368ffa Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 24 Jul 2021 16:11:15 -0700 Subject: [PATCH 1/4] Simplify socket symlink-attack checking * 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. --- lib-src/emacsclient.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 8346524a3e..434db1bec4 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -80,9 +80,6 @@ Copyright (C) 1986-1987, 1994, 1999-2021 Free Software Foundation, Inc. #include #include -#ifndef WINDOWSNT -# include -#endif #include #include #include @@ -94,10 +91,6 @@ Copyright (C) 1986-1987, 1994, 1999-2021 Free Software Foundation, Inc. # 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 { -- 2.31.1