Commit 08754e6c authored by Max Kellermann's avatar Max Kellermann

system/Error: add IsAccessDenied()

parent 3843972b
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment