util: add a function to set umask to 077
Useful to ensure files are written without group/other read rights.
This commit is contained in:
parent
e7c8a32a28
commit
7385c036bd
|
@ -413,4 +413,13 @@ std::string get_nix_version_display_string()
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
void set_strict_default_file_permissions(bool strict)
|
||||||
|
{
|
||||||
|
#if defined(__MINGW32__) || defined(__MINGW__)
|
||||||
|
// no clue about the odd one out
|
||||||
|
#else
|
||||||
|
mode_t mode = strict ? 077 : 0;
|
||||||
|
umask(mode);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,4 +158,6 @@ namespace tools
|
||||||
/*! \brief where the installed handler is stored */
|
/*! \brief where the installed handler is stored */
|
||||||
static std::function<void(int)> m_handler;
|
static std::function<void(int)> m_handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void set_strict_default_file_permissions(bool strict);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue