]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
global-init: chown pid files
authorKarol Mroz <kmroz@suse.com>
Sat, 23 Apr 2016 11:54:45 +0000 (13:54 +0200)
committerKarol Mroz <kmroz@suse.com>
Sat, 23 Apr 2016 13:41:51 +0000 (15:41 +0200)
Signed-off-by: Karol Mroz <kmroz@suse.com>
src/global/global_init.cc

index 18980c95ab09054acf66d4f7cb731949057b66b9..4d7addf2918f6380786847234023a99d330f6c83 100644 (file)
@@ -339,6 +339,12 @@ int global_init_prefork(CephContext *cct)
     if (pidfile_write(g_conf) < 0)
       exit(1);
 
+    if ((cct->get_init_flags() & CINIT_FLAG_DEFER_DROP_PRIVILEGES) &&
+       (cct->get_set_uid() || cct->get_set_gid())) {
+      chown_path(conf->pid_file, cct->get_set_uid(), cct->get_set_gid(),
+                cct->get_set_uid_string(), cct->get_set_gid_string());
+    }
+
     return -1;
   }
 
@@ -399,6 +405,12 @@ void global_init_postfork_start(CephContext *cct)
 
   if (pidfile_write(g_conf) < 0)
     exit(1);
+
+  if ((cct->get_init_flags() & CINIT_FLAG_DEFER_DROP_PRIVILEGES) &&
+      (cct->get_set_uid() || cct->get_set_gid())) {
+    chown_path(conf->pid_file, cct->get_set_uid(), cct->get_set_gid(),
+              cct->get_set_uid_string(), cct->get_set_gid_string());
+  }
 }
 
 void global_init_postfork_finish(CephContext *cct)