core: Prevent exception throwing when dropping privileges is not supported and not requested

The exception still be thrown, if config file requests privilege dropping.

Change-Id: I856207958354410fa45da7ccc73b46b99f74d9e7
Refs: #2515
This commit is contained in:
Alexander Afanasyev
2015-02-12 16:44:24 -08:00
parent 6f570de8d7
commit 9cfeecaa2f
+3 -1
View File
@@ -131,7 +131,9 @@ PrivilegeHelper::initialize(const std::string& userName, const std::string& grou
s_normalUid = passwd.pw_uid;
}
#else
throw Error("Dropping and raising privileges is not supported on this platform");
if (!userName.empty() || !groupName.empty()) {
throw Error("Dropping and raising privileges is not supported on this platform");
}
#endif // HAVE_PRIVILEGE_DROP_AND_ELEVATE
}