Skip to content

Commit a0ce8ec

Browse files
authored
Fixing misleading message when polycubed is not executed as root
When running polycubed as normal user, the printed error is misleading, as it appears that polycubed cannot open the log file. Signed-off-by: Fulvio Risso <fulvio.risso@polito.it>
1 parent 552885f commit a0ce8ec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/polycubed/src/polycubed.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ int main(int argc, char *argv[]) {
173173
exit(EXIT_SUCCESS);
174174
}
175175
} catch (const std::exception &e) {
176+
177+
// The problem of the error in loading the config file may be due to
178+
// polycubed executed as normal user
179+
if (getuid())
180+
logger->critical("polycubed should be executed with root privileges");
181+
176182
logger->critical("Error loading config: {}", e.what());
177183
exit(EXIT_FAILURE);
178184
}
@@ -182,7 +188,7 @@ int main(int argc, char *argv[]) {
182188
logger->set_level(config.getLogLevel());
183189

184190
if (getuid()) {
185-
logger->critical("please run polycubed as root");
191+
logger->critical("polycubed should be executed with root privileges");
186192
exit(EXIT_FAILURE);
187193
}
188194

0 commit comments

Comments
 (0)