From: Carl Hetherington Date: Thu, 27 Sep 2018 14:49:32 +0000 (+0100) Subject: swaroop: take ownership of config file if we're run as root. X-Git-Tag: v2.13.57~8 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=3df4d6271a6a660fdce143dcd65467c402e98976 swaroop: take ownership of config file if we're run as root. --- 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 ());