The man pages for mount(...) GLibC function do not document when a EROFS might be recieved. When mounting without READONLY flag: I have a UDF formatted disk which returns EACCESS as it is read only. I have a VFat formatted disk (with hardware write protect turned on) which returns EROFS. I think a line should be added to the man pages to cover EROFS, but I am not sure on the detail of when it would happen.
Investigating some background details: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/278954 is relevant, I think. It seems that different filesystems return EROFS or EACCES in the case where one attempts to mount a filesystem read-write and that filesystem has been marked read-only. grepping for ERORFS and EACCES in the various super.c files in the kernel source shows various cases where these errors can occur for different filesystems
So, in mount(2) there was already a sentence under EACCES about read-only filesystems. I extended the text, so that it now reads: EACCES Mounting a read-only filesystem was attempted without giv‐ ing the MS_RDONLY flag. The file system may be read-only for various reasons, including: it resides on a read-only optical disk; it is resides on a device with a physical switch that has been set to mark the device read-only; the filesystem implemen‐ tation was compiled with read-only support; or errors were detected when initially mounting the filesystem, so that it was marked read-only and can't be remounted as read-write (until the errors are fixed). Some filesystems instead return the error EROFS on an attempt to mount a read-only filesystem. And I added the following entry for EROFS: EROFS Mounting a read-only filesystem was attempted without giv‐ ing the MS_RDONLY flag. See EACCES, above. I'll close this bug now. Please reopen if you think something is still lacking. Thanks for the bug report!
Sounds great Michael, thanks!