A fix was submitted to address this issue with:
pt::write_json(...)
changePermission(666)
The first line will create the configuration file if it does not exist or update it if it has already been created. Note that the 2nd line will set permission as 666 every time this file is created/updated -- a new problem arises:
boost::filesystem::permissions: Operation not permitted: "/our/product/config.json"
A non-root user is not allowed to change the permission of a file owned by another user, not mention that this configuration file is created by root and owned by root.
A workaround for this is: set the permission to 666 only when it's created. Something like this:
bool flag = isConfigFileExist(...)
pt::write_json(...)
if (!flag) {
changePermission(666)
}
No comments:
Post a Comment