admin-socket: use chown instead of fchown

fchown() returns success, but does not change asok file
ownership. chown() does.

Signed-off-by: Karol Mroz <kmroz@suse.com>
This commit is contained in:
Karol Mroz 2016-04-25 17:24:07 +02:00
parent 088cc66a94
commit 3d051a58cc
2 changed files with 1 additions and 5 deletions

View File

@ -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: "

View File

@ -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());
}
}