From: Karol Mroz Date: Mon, 25 Apr 2016 15:24:07 +0000 (+0200) Subject: admin-socket: use chown instead of fchown X-Git-Tag: v11.0.0~829^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3d051a58cc117ff79d4cdd768603d1dec8ca7f60;p=ceph-ci.git admin-socket: use chown instead of fchown fchown() returns success, but does not change asok file ownership. chown() does. Signed-off-by: Karol Mroz --- diff --git a/src/common/admin_socket.cc b/src/common/admin_socket.cc index aedaed584ef..40fa12fd36f 100644 --- a/src/common/admin_socket.cc +++ b/src/common/admin_socket.cc @@ -290,7 +290,7 @@ void* AdminSocket::entry() void AdminSocket::chown(uid_t uid, gid_t gid) { if (m_sock_fd >= 0) { - int r = ::fchown(m_sock_fd, uid, gid); + int r = ::chown(m_path.c_str(), uid, gid); if (r < 0) { r = -errno; lderr(m_cct) << "AdminSocket: failed to chown socket: " diff --git a/src/common/common_init.cc b/src/common/common_init.cc index 9f7ec20e401..d4ed4f964df 100644 --- a/src/common/common_init.cc +++ b/src/common/common_init.cc @@ -130,10 +130,6 @@ void common_init_finish(CephContext *cct) if ((flags & CINIT_FLAG_DEFER_DROP_PRIVILEGES) && (cct->get_set_uid() || cct->get_set_gid())) { - // FIXME: Changing ownership of a socket file via the fd does not work as - // expected. The socket file is listed as owned by the same - // 'user:group' which the daemon that created the socket had during - // open(). cct->get_admin_socket()->chown(cct->get_set_uid(), cct->get_set_gid()); } }