[EXTERNAL] Re: Weird issue with file permissions

Lavrentiev, Anton (NIH/NLM/NCBI) [C] lavr@ncbi.nlm.nih.gov
Sat Jul 2 19:37:05 GMT 2022

> what your test program was actually doing.  But you seem to be assuming that
> calling fchmod on a socket descriptor should affect the permissions on the
> socket file (assuming the socket is bound).  Is that documented anywhere?  POSIX
> says that the behavior of fchmod on a socket descriptor is unspecified

The socket file descriptor for a bound UNIX sockets refers to an object in a filesystem
(it's practically a file), which the bind() system call creates.  The access to the socket
is controlled by the permission bits, when someone actually tries to connect to it,
so permissions should be working for these objects (otherwise, there's no other way!)

And fchmod() for a bound Unix socket works on Linux and many other Unix flavors, actually.

Anton Lavrentiev
Contractor NIH/NLM/NCBI

More information about the Cygwin mailing list