Subject: Re: Are permissions of local sockets correct?
To: Michael van Elst <mlelstv@serpens.de>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 08/22/2005 21:34:52
On 8/22/05, Michael van Elst <mlelstv@serpens.de> wrote:
> jmmv84@gmail.com ("Julio M. Merino Vidal") writes:
>=20
> >while trying gamin (a file alteration monitor, like fam), I found that i=
t
> >refuses to work because it detects that the local sockets it creates
> >have "too much permissions" (that is, 777).
>=20
> Many UNIX variants ignore the mode bits for local sockets. This is
> probably just 'traditional' but also makes local sockets more similar
> to network sockets.
>=20
> >FreeBSD, OpenBSD and Linux respect the umask.  If our behavior is
> >not correct, what about the following patch?
>=20
> Our behaviour is at least not consistent as connect() seems to honor
> the mode bits when you change them with chmod.
>=20
> Does fchmod() work?

No, it doesn't.  It returns EINVAL.

I also checked what Linux does and, while it returns success, it does
not change the permissions.

chmod works correctly, though.

What should we do then?  Make fchmod(2) work with sockets too?

Thanks.

--=20
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/