[ovs-git] Open vSwitch: socket-util: Properly set socket permissions in make_unix_socket(). (master)

dev at openvswitch.org dev at openvswitch.org
Tue Apr 19 18:26:14 UTC 2011

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  e2bd05933f2c813e1cce42b8fe0db6230dffb13c (commit)
      from  abd4a95de3249e2beddcd921e981baa21cc6d7fd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e2bd05933f2c813e1cce42b8fe0db6230dffb13c
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=e2bd05933f2c813e1cce42b8fe0db6230dffb13c
Author: Ben Pfaff <blp at nicira.com>
socket-util: Properly set socket permissions in make_unix_socket().
Under Linux, at least, bind and fchmod interact for Unix sockets in a way
that surprised me.  Calling fchmod() on a Unix socket successfully sets the
permissions for the socket's own inode.  But that has no effect on any
inode that has already been created in the file system by bind(), because
that inode is not the same as the one for the Unix socket itself.

However, if you bind() *after* calling fchmod(), then the bind() takes the
permissions for the new inode from the Unix socket inode, which has the
desired effect.

This also adds a more portable fallback for non-Linux systems.

Reported-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>


Summary of changes:
 lib/socket-util.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

Open vSwitch

More information about the git mailing list