util: add a function to set umask to 077

Useful to ensure files are written without group/other read rights.
pull/801/head
moneromooo-monero 8 years ago
parent e7c8a32a28
commit 7385c036bd
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

@ -413,4 +413,13 @@ std::string get_nix_version_display_string()
}
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 */
static std::function<void(int)> m_handler;
};
void set_strict_default_file_permissions(bool strict);
}

Loading…
Cancel
Save