]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
admin-socket: use chown instead of fchown
authorKarol Mroz <kmroz@suse.com>
Mon, 25 Apr 2016 15:24:07 +0000 (17:24 +0200)
committerKarol Mroz <kmroz@suse.com>
Mon, 25 Apr 2016 15:24:07 +0000 (17:24 +0200)
fchown() returns success, but does not change asok file
ownership. chown() does.

Signed-off-by: Karol Mroz <kmroz@suse.com>
src/common/admin_socket.cc
src/common/common_init.cc

index aedaed584ef6148680b9b2ed2fdbe164dcfc4034..40fa12fd36f7cbe8fb1784ae3bc6544cd782ef46 100644 (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: "
index 9f7ec20e4010326bfbea9abc3b59f07e050a8547..d4ed4f964dfb0ebcfb75eba20bf86398649945bc 100644 (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());
   }
 }