mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2025-04-21 12:27:27 +03:00
Provide file permissions for newly created file
Since O_CREAT is passed, we have to provide permission flags too.
This commit is contained in:
@@ -92,7 +92,7 @@ constexpr int writeOpenFlags =
|
|||||||
bool writeStringToFile(string const& filename, string const& data) {
|
bool writeStringToFile(string const& filename, string const& data) {
|
||||||
// Open temporary file.
|
// Open temporary file.
|
||||||
string tempname = filename + '~';
|
string tempname = filename + '~';
|
||||||
int fd = open(tempname.c_str(), writeOpenFlags);
|
int fd = open(tempname.c_str(), writeOpenFlags, S_IRUSR | S_IWUSR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user