Add permission error checking.
Add new library that support permission checking.
Switch to using OSError.