system/Error: add IsAccessDenied()

This commit is contained in:
Max Kellermann 2015-12-29 12:56:23 +01:00
parent 3843972b05
commit 08754e6ce7

View File

@ -138,4 +138,17 @@ IsFileNotFound(const std::system_error &e)
#endif
}
gcc_pure
static inline bool
IsAccessDenied(const std::system_error &e)
{
#ifdef WIN32
return e.code().category() == std::system_category() &&
e.code().value() == ERROR_ACCESS_DENIED;
#else
return e.code().category() == std::system_category() &&
e.code().value() == EACCES;
#endif
}
#endif