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
diff --git a/core/privilege-helper.cpp b/core/privilege-helper.cpp
index 93b7142..ba3da78 100644
--- a/core/privilege-helper.cpp
+++ b/core/privilege-helper.cpp
@@ -131,7 +131,9 @@
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
}