From ecfb6f11bcfe614f890d7f9f5e6633b2178c45a4 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 31 May 2001 05:25:46 +0000 Subject: * path.cc (chdir): Always send unsigned chars to isspace since newlib's isspace doesn't deal well with "negative" chars. * fhandler.cc (fhandler_disk_file::open): Propagate remote status of file garnered from path_conv. Move #! checking to fstat. (fhandler_disk_file::fstat): Reorganize st_mode setting to eliminate duplication. Move check for #! here from fhandler::open. * fhandler.h (fhandler_base::isremote): New method. (fhandler_base::set_isremote): Ditto. (fhandler_base::set_execable_p): Also record "don't care if executable state". (fhandler_base::dont_care_if_execable): New method. * path.cc (path_conv::check): Clear new flags. Appropriately set vol_flags, drive_type, and is_remote_drive. * path.h: Add new flags and methods for manipulating them. * syscalls.cc (_unlink): Use isremote() to determine if a path is remote rather than calling GetDriveType. (stat_worker): Ditto. * security.cc (get_file_attribute): Or attribute with result of NTReadEA to be consistent with get_nt_attribute. --- winsup/cygwin/syscalls.cc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'winsup/cygwin/syscalls.cc') diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index a4252532f..98df195f9 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -133,14 +133,10 @@ _unlink (const char *ourname) if (i > 0) { - DWORD dtype; if (os_being_run == winNT || lasterr != ERROR_ACCESS_DENIED) goto err; - char root[MAX_PATH]; - strcpy (root, win32_name); - dtype = GetDriveType (rootdir (root)); - if (dtype & DRIVE_REMOTE) + if (win32_name.isremote ()) { syscall_printf ("access denied on remote drive"); goto err; /* Can't detect this, unfortunately */ @@ -708,7 +704,7 @@ chown_worker (const char *name, unsigned fmode, uid_t uid, gid_t gid) attrib |= S_IFDIR; res = get_file_attribute (win32_path.has_acls (), win32_path.get_win32 (), - (int *) &attrib, + (int *) &attrib, &old_uid, &old_gid); if (!res) @@ -1016,7 +1012,6 @@ stat_worker (const char *caller, const char *name, struct stat *buf, uid_t uid; gid_t gid; - char root[MAX_PATH]; UINT dtype; fhandler_disk_file fh (NULL); @@ -1043,8 +1038,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf, debug_printf ("%d = file_attributes for '%s'", atts, real_path.get_win32 ()); - strcpy (root, real_path.get_win32 ()); - dtype = GetDriveType (rootdir (root)); + dtype = real_path.drive_type; if ((atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) || (os_being_run == winNT @@ -1108,8 +1102,9 @@ stat_worker (const char *caller, const char *name, struct stat *buf, else buf->st_mode = S_IFREG; if (!real_path.has_acls () - || get_file_attribute (real_path.has_acls (), real_path.get_win32 (), - &buf->st_mode, &buf->st_uid, &buf->st_gid)) + || get_file_attribute (TRUE, real_path.get_win32 (), + &buf->st_mode, + &buf->st_uid, &buf->st_gid)) { buf->st_mode |= STD_RBITS | STD_XBITS; if ((atts & FILE_ATTRIBUTE_READONLY) == 0) -- cgit v1.2.3