Subject: Re: bug#35406: Build error for emacsclient on FreeBSD

From: Paul Eggert <[email-masked]>
Date: Wed, 24 Apr 2019 17:45:00 -0700

Josh Howard wrote:
> I'd propose it be switched to eaccess() which should be a synonym on Linux and makes it a bit more portable.
Sorry, I messed up. I should have used the POSIX-specified faccessat,
which has a Gnulib portability emulation for platforms lacking
faccessat. I installed the attached into master; please give it a try.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 5871a18ce6..fd56007b15 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1472,7 +1472,7 @@ set_local_socket (char const *server_name)
 	  int sockdirnamelen = snprintf (sockdirname, sizeof sockdirname,
 					 "/run/user/%"PRIuMAX, id);
 	  if (0 <= sockdirnamelen && sockdirnamelen < sizeof sockdirname
-	      && euidaccess (sockdirname, X_OK) == 0)
+	      && faccessat (AT_FDCWD, sockdirname, X_OK, AT_EACCESS) == 0)
 	    message
 	      (true,
 	       ("%s: Should XDG_RUNTIME_DIR='%s' be in the environment?\n"