fchown() returns success, but does not change asok file
ownership. chown() does.
Signed-off-by: Karol Mroz <kmroz@suse.com>
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: "
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());
}
}