* fhandler.cc (fhandler_base::fhaccess): Add check for R/O file system.

* security.cc (check_registry_access): Set errno to EROFS when checking
	for W_OK.
This commit is contained in:
Corinna Vinschen 2007-07-17 14:39:02 +00:00
parent a58a8938cc
commit 52a6e6d8c7
3 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-07-17 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::fhaccess): Add check for R/O file system.
* security.cc (check_registry_access): Set errno to EROFS when checking
for W_OK.
2007-07-17 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Move setting

View File

@ -443,6 +443,12 @@ fhandler_base::fhaccess (int flags)
eaccess_done:
set_errno (EACCES);
done:
if (!res && (flags & W_OK) && get_device () == FH_FS
&& (pc.fs_flags () & FILE_READ_ONLY_VOLUME))
{
set_errno (EROFS);
res = -1;
}
debug_printf ("returning %d", res);
return res;
}

View File

@ -2044,7 +2044,10 @@ check_registry_access (HANDLE hdl, int flags)
ret = check_access (sd, mapping, desired, flags);
/* As long as we can't write the registry... */
if (flags & W_OK)
ret = -1;
{
set_errno (EROFS);
ret = -1;
}
debug_printf ("flags %x, ret %d", flags, ret);
return ret;
}