if (g_conf->log_flush_on_exit)
g_ceph_context->_log->set_flush_on_exit();
+ // drop privileges?
+ ostringstream priv_ss;
+
// consider --setuser root a no-op, even if we're not root
if (getuid() != 0) {
if (g_conf->setuser.length()) {
cerr << "ignoring --setuser " << g_conf->setuser << " since I am not root"
<< std::endl;
- g_conf->set_val("setuser", "", false);
}
if (g_conf->setgroup.length()) {
cerr << "ignoring --setgroup " << g_conf->setgroup
<< " since I am not root" << std::endl;
- g_conf->set_val("setgroup", "", false);
}
- }
-
- // drop privileges?
- ostringstream priv_ss;
- if (g_conf->setgroup.length() ||
- g_conf->setuser.length()) {
+ } else if (g_conf->setgroup.length() ||
+ g_conf->setuser.length()) {
uid_t uid = 0; // zero means no change; we can only drop privs here.
gid_t gid = 0;
std::string uid_string;