mirror of
https://github.com/ceph/ceph
synced 2025-01-29 22:43:40 +00:00
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:
parent
088cc66a94
commit
3d051a58cc
@ -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: "
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user