summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-09-27 15:49:32 +0100
committerCarl Hetherington <cth@carlh.net>2018-09-27 15:49:32 +0100
commit3df4d6271a6a660fdce143dcd65467c402e98976 (patch)
treec7602c86940734c68fa268a99c7fe740b1fb8dfc /src
parent2541b18e598db86ac4ce2aa5c0bbb588344c3dbb (diff)
swaroop: take ownership of config file if we're run as root.
Diffstat (limited to 'src')
-rw-r--r--src/lib/config.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index e1d5b958d..fbf0e3b63 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -229,6 +229,14 @@ void
Config::read ()
try
{
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+ if (geteuid() == 0) {
+ /* Take ownership of the config file if we're root */
+ chown (config_file().string().c_str(), 0, 0);
+ chmod (config_file().string().c_str(), 0644);
+ }
+#endif
+
cxml::Document f ("Config");
f.read_file (config_file ());