On Fri, Jun 25, 2010 at 08:59:18AM -0400, Matthew Mondor wrote:
> On Thu, 24 Jun 2010 22:55:51 -0400
> Thor Simon <tls%coyotepoint.com@localhost> wrote:
>
> > Can anyone tell me why, exactly, we shouldn't remove bound AF_LOCAL
> > sockets from the filesystem on last close? The following test program
> > produces "second socket bind failed" on every system I've tested it on,
> > and seems to cover the only possible use case for this "feature"...
>
> I initially had the impression that leaving the socket around was a
> feature to allow re-binding to the same file by an unprivileged process
> after first creating the socket node as root (i.e. at a location where
> unprivileged processes cannot create new files such as /var/run/) to
> then set its permissions in a way to permit the unprivileged user or
> group to bind(2) it.
Yes, that was my impression as well. But, as you note, SO_REUSEADDR
has no effect on the behavior of either of our test programs.
I understand it's always been this way. But to my mind, "this way" has
always been rather stupid, and the funny thing is, changing it doesn't
seem like it can break anything except applications which exit if
unlink() fails with ENOENT -- which would, itself, be a bug.
Thor