1 There seems to be a bug in our fstat() implementation when called on a socket.
2 The st_uid member always seems to be 0.
3 NetBSD seems to have a similar problem see
4 https://gnu.emacs.bug.narkive.com/cAVl8Cff/bug-43002-27-1-emacsclient-does-not-like-owner-of-socket-on-netbsd
6 --- emacs-28.1/lib-src/emacsclient.c.orig 2022-03-11 08:04:21.000000000 +0000
7 +++ emacs-28.1/lib-src/emacsclient.c 2022-04-05 10:48:23.309671173 +0000
10 if (fstat (dirfd, &st) != 0)
12 - if (st.st_uid != uid || (st.st_mode & (S_IWGRP | S_IWOTH)))
13 + if (st.st_uid != uid || (st.st_uid == (uid_t)0) || (st.st_mode & (S_IWGRP | S_IWOTH)))