* 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:
@ -39,7 +39,8 @@ enum pathconv_arg
|
||||
PC_NULLEMPTY = 0x0020,
|
||||
PC_CHECK_EA = 0x0040,
|
||||
PC_POSIX = 0x0080,
|
||||
PC_NO_ACCESS_CHECK = 0x00800000
|
||||
PC_NO_ACCESS_CHECK = 0x00800000,
|
||||
PC_WRITABLE = 0x00400000
|
||||
};
|
||||
|
||||
enum case_checking
|
||||
@ -51,7 +52,7 @@ enum case_checking
|
||||
|
||||
#define PC_NONULLEMPTY -1
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include "sys/mount.h"
|
||||
|
||||
enum path_types
|
||||
{
|
||||
@ -62,6 +63,7 @@ enum path_types
|
||||
PATH_NOTEXEC = MOUNT_NOTEXEC,
|
||||
PATH_CYGWIN_EXEC = MOUNT_CYGWIN_EXEC,
|
||||
PATH_ENC = MOUNT_ENC,
|
||||
PATH_RO = MOUNT_RO,
|
||||
PATH_ALL_EXEC = (PATH_CYGWIN_EXEC | PATH_EXEC),
|
||||
PATH_NO_ACCESS_CHECK = PC_NO_ACCESS_CHECK,
|
||||
PATH_LNK = 0x01000000,
|
||||
@ -149,6 +151,7 @@ class path_conv
|
||||
int is_lnk_special () const {return is_fs_device () || isfifo () || is_lnk_symlink ();}
|
||||
int issocket () const {return dev.devn == FH_UNIX;}
|
||||
int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
|
||||
bool isro () const {return !!(path_flags & PATH_RO);}
|
||||
bool exists () const {return fileattr != INVALID_FILE_ATTRIBUTES;}
|
||||
bool has_attribute (DWORD x) const {return exists () && (fileattr & x);}
|
||||
int isdir () const {return has_attribute (FILE_ATTRIBUTE_DIRECTORY);}
|
||||
|
Reference in New Issue
Block a user