* cygtls.cc (_cygtls::remove): Eliminate compiler warning.

* dir.cc (mkdir): Check path for writability.
(rmdir): Ditto.  Remove check for special directories.
* path.cc (path_conv::check): Set PATH_RO for virtual devices.  Set error if
read-only and asked for writability.
* path.h (pathconv_arg): Add PC_WRITABLE.
(path_types): Add PATH_RO.
(path_conv::isro): Add (currently unused) check for read-only filesystem.
Return "ENOSHARE" when we know a share doesn't exist.
* include/sys/mount.h: Add MOUNT_RO flag.
* autoload.cc (WNetGetResourceInformationA): Import.
* fhandler_netdrive.cc (fhandler_netdrive::exists): Detect actual existence of
remote system rather than always assuming that it exists.
This commit is contained in:
Christopher Faylor
2005-05-13 03:21:39 +00:00
parent cf55bf5ee8
commit 66582dd6e7
8 changed files with 72 additions and 26 deletions

View File

@ -675,6 +675,7 @@ path_conv::check (const char *src, unsigned opt,
fileattr = INVALID_FILE_ATTRIBUTES;
goto virtual_component_retry;
}
path_flags |= PATH_RO;
goto out;
}
/* devn should not be a device. If it is, then stop parsing now. */
@ -881,15 +882,21 @@ virtual_component_retry:
out:
bool strip_tail = false;
/* If the user wants a directory, do not return a symlink */
if (!need_directory || error)
if ((opt & PC_WRITABLE) && (path_flags & PATH_RO))
{
debug_printf ("%s is on a read-only filesystem", path);
error = EROFS;
return;
}
else if (isvirtual_dev (dev.devn) && fileattr == INVALID_FILE_ATTRIBUTES)
{
error = dev.devn == FH_NETDRIVE ? ENOSHARE : ENOENT;
return;
}
else if (!need_directory || error)
/* nothing to do */;
else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
path_flags &= ~PATH_SYMLINK;
else if (isvirtual_dev (dev.devn) && fileattr == INVALID_FILE_ATTRIBUTES)
{
error = ENOENT;
return;
}
else
{
debug_printf ("%s is a non-directory", path);