summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
Commit message (Collapse)AuthorAgeFilesLines
* * mount.h (fs_info::inited): New inline method.Corinna Vinschen2010-04-261-24/+29
| | | | | | | | | * path.cc (path_conv::check): Clear filesystem info if following a symlink. Use new fs_info::inited method to check if FS info is already available. (symlink_info::check): Drop fs_update_called. Use fs_info::inited method instead. Streamline test for leading space and trailing dot or space. Add comments.
* * path.h (get_nt_native_path): Add third parameter to declaration andCorinna Vinschen2010-04-231-28/+46
| | | | | | | | | | | | | | | | | | | | declare with regparms. * path.cc (get_nt_native_path): Add third parameter to allow conversion of leading and trailing dots and spaces on filesystems only supporting filenames following DOS rules. (path_conv::get_nt_native_path): Call get_nt_native_path according to fs.has_dos_filenames_only flag. (getfileattr): Accommodate new parameter to get_nt_native_path. (symlink_info::check): Revamp fs_update_called handling to call fs.update only once per call. Call get_nt_native_path according to fs.has_dos_filenames_only flag. Streamline filesystem dependent code not to be called more than once unnecessarily. Drop code tweaking incoming path for broken filesystems only allowing DOS pathnames. Rely on changed get_nt_native_path instead. * mount.cc (fillout_mntent): Accommodate new parameter to get_nt_native_path. * strfuncs.cc (tfx_rev_chars): New conversion table with comment. (sys_cp_wcstombs): Use tfx_rev_chars rather than tfx_chars.
* * path.cc (symlink_info::check): Make sure to restart only once.Corinna Vinschen2010-04-221-1/+3
|
* * mount.cc (GETVOLINFO_VALID_MASK): Drop FILE_SEQUENTIAL_WRITE_ONCECorinna Vinschen2010-04-221-38/+83
| | | | | | | | | | | | | | | | | from mask. Expand the comment a bit. (WIN_FAT_FLAGS): New define. (FS_IS_WINDOWS_FAT): New macro. (fs_info::update): Handle remote FS faking to be FAT. Subsume under CIFS. Check for NWFS and has_buggy_basic_info only for remote filesystems. Add check for has_dos_filenames_only. * mount.h (class fs_info): Add has_dos_filenames_only status flag. Implement accessors. * path.cc (symlink_info::check): Rearrange variable definitions to clear them up. Add a restart label to allow a clean restart within the method. Add a check for broken filesystems only allowing DOS pathnames in case we encounter a STATUS_OBJECT_NAME_NOT_FOUND status. If all checks point to one of that, restart method with tweaked incoming path. Add lengthy comments to explain what we do.
* * path.cc (symlink_info::check): Fix a comment.Corinna Vinschen2010-04-221-5/+5
|
* * path.cc (cygwin_create_path): Free memory on error.Christopher Faylor2010-04-201-4/+7
|
* * path.cc (path_conv::set_normalized_path): Use crealloc_abort to avoid aChristopher Faylor2010-04-091-1/+1
| | | | | | memory leak. * path.h (path_conv::operator =): Just use cstrdup to allocate normalized_path, avoiding attempt to free a pointer which is allocated in another pc.
* * spawn.cc (find_exec): Enable finding paths in backslash notation,Corinna Vinschen2010-03-291-0/+10
| | | | | | | especially for the exec[vl]p functions. * path.cc (symlink_info::check): Disable returning directories with suffix appended here.
* * path.cc (warn_msdos): Enforce extended hex printing of multibyteCorinna Vinschen2010-02-201-2/+2
| | | | pathnames.
* * path.cc (path_conv::check): Treat native DOS paths as "noacl".Corinna Vinschen2010-02-151-5/+7
|
* * path.cc (symlink_info::check_nfs_symlink): Reopen file withCorinna Vinschen2010-02-061-0/+7
| | | | | FILE_READ_EA access since, surprisingly, you need it to read EAs even on NFS.
* Throughout, use FileBothDirectoryInformation info class rather thanCorinna Vinschen2010-01-291-15/+19
| | | | | | | | | | | | | | | | | | FileDirectoryInformation info class to avoid problems with incomplete filesystem implementations. Fix comments accordingly. * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Set fname->Length to 0 in error case to avoid potential crash in debug output. (fhandler_disk_file::readdir): Try to speed up the working default case. Check for STATUS_INVALID_NETWORK_RESPONSE as potential status value returned by filesystems not implementing FileIdBothDirectoryInformation. * ntdll.h (STATUS_INVALID_NETWORK_RESPONSE): Define. (FILE_BOTH_DIRECTORY_INFORMATION): Rename to official name. * path.cc (symlink_info::check): Don't request FILE_READ_EA access, it's not required for NFS. Try to speed up the working default case. Check for STATUS_INVALID_NETWORK_RESPONSE as potential status value returned by filesystems not supporting non-NULL EA parameters. Fix the way fs.update is called. Improve debug output.
* * globals.cc (ro_u_nwfs): New R/O unicode string.Corinna Vinschen2010-01-121-7/+9
| | | | | | | | | | | | | * mount.cc (fs_info::update): Check for NWFS filesystem. Set has_buggy_basic_info, if so. Add comment to explain why. (fillout_mntent): Add "nwfs" string to fs_names array. * mount.h (enum fs_info_type): Add nwfs. (class fs_info): Add has_buggy_basic_info status flag. Add accessors for has_buggy_basic_info and is_nwfs. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Accommodate filesystems with broken FileBasicInformation handling. * path.cc (symlink_info::check): Ditto. * path.h (path_conv::has_buggy_basic_info): Add method.
* * dtable.cc (build_fh_name_worker): Remove. Move all functionalityCorinna Vinschen2010-01-121-15/+2
| | | | | | | | | | | | | | | | | | back into build_fh_name. (build_fh_name): Drop unused HANDLE parameter. Drop call to pc.fillin. Remove disabled build_fh_name with UNICODE_STRING name parameter. * dtable.h (build_fh_name): Drop HANDLE parameter from declaration. Remove declaration for build_fh_name with UNICODE_STRING name parameter. * path.cc (path_conv::fillin): Remove. (symlink_info::check): Fix comment. * path.h (path_conv::fillin): Remove declaration. * dir.cc: Accommodate change in build_fh_name parameters throughout. * sec_acl.cc: Ditto. * syscalls.cc: Ditto. * ntea.cc (getxattr_worker): Fix debug output. (setxattr_worker): Ditto. * times.cc (utimens_worker): Ditto.
* * path.cc (symlink_info::check): Set fileattr toCorinna Vinschen2009-12-241-1/+6
| | | | FILE_ATTRIBUTE_DIRECTORY in a certain error condition. Explain why.
* * path.cc (cygwin_conv_path): Add band-aid including comment to avoidCorinna Vinschen2009-12-211-1/+20
| | | | conversion from POSIX "." to Win32 ".\\".
* * fhandler_disk_file.cc (is_volume_mountpoint): Align check withCorinna Vinschen2009-11-101-14/+18
| | | | | | symlink_info::check_reparse_point(). * path.cc (symlink_info::check_reparse_point): Rearrange slightly. Add code path for unrecognized repare point types. Add comment.
* * path.cc (symlink_info::check_reparse_point): Always checkCorinna Vinschen2009-11-091-6/+3
| | | | | | | SubstituteName for volume string to recognize volume mount points. Reuse subst when calling sys_wcstombs. * syscalls.cc (rename): Set errno to EBUSY when trying to rename volume mount points. Explain why.
* * miscfuncs.h (transform_chars): Declare. Define inline variation here.Corinna Vinschen2009-11-021-57/+0
| | | | | | | | | | | | | * mount.cc (mount_info::from_fstab): Remove extern declaration of transform_chars. * path.cc (tfx_chars): Move to strfuncs.cc. (transform_chars): Ditto. * strfunc.cc (tfx_chars): Moved here from path.cc. (transform_chars): Ditto. (sys_cp_wcstombs): Make UNICODE private use area conversion roundtrip save for all characters. (sys_cp_mbstowcs): Ditto, by removing special case for UTF-8 sequences representing U+f0XX UNICODE chars. Fix typo in comment.
* path.ccCorinna Vinschen2009-11-021-1/+1
|
* * sec_helper.cc (security_descriptor::free): If sd_size is 0, callCorinna Vinschen2009-10-301-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | LocalFree instead of ::free. * sec_acl.cc: Throughout replace old ACE flag definitions with current definitions as used in MSDN man pages. * security.cc: Ditto. * fhandler.cc (fhandler_base::open): Make sure file has really been just created before fixing file permissions. Add S_JUSTCREATED attribute to set_file_attribute call. * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Always create dir with default security descriptor and fix descriptor afterwards. Add S_JUSTCREATED flag to set_file_attribute call. * fhandler_socket.cc (fhandler_socket::bind): Ditto for AF_LOCAL socket files. * path.cc (symlink_worker): Ditto for symlinks. * security.cc (get_file_sd): Call GetSecurityInfo rather than NtQuerySecurityObject. Explain why. Change error handling accordingly. (alloc_sd): Skip non-inherited, non-standard entries in ACL if S_JUSTCREATED attribute is set. Explain why. Minor format fixes. * security.h (S_JUSTCREATED): New define. (security_descriptor::operator=): New operator.
* * path.cc (tfx_chars): Convert all ASCII control characters exceptCorinna Vinschen2009-10-091-16/+38
| | | | | ASCII NUL as well. Change layout to make the conversions more clear. Add comment.
* * dcrt0.cc (dll_crt0_1): Move cxx_malloc reset kluge from here.Christopher Faylor2009-10-021-17/+26
| | | | | | (check_sanity_and_sync): to here. * path.cc (has_dot_last_component): Rewrite to detect some corner cases that were previously uncaught.
* Provide euidaccess, canonicalize_file_name; fix fchmodat.Eric Blake2009-09-251-8/+16
| | | | | | | | | | | * syscalls.cc (fchmodat): lchmod is not yet implemented. (euidaccess): New function. * path.cc (realpath): Update comment. (canonicalize_file_name): New function. * include/cygwin/stdlib.h (canonicalize_file_name): Declare it. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * cygwin.din: Export canonicalize_file_name, eaccess, euidaccess. * posix.sgml: Mention them.
* * path.cc (symlink_worker): Rework error handling to generate LinuxCorinna Vinschen2009-09-221-4/+13
| | | | compatible errno in case of trailing slash in newpath.
* * cygheap.h (cwdstuff::get_posix): Convert to const inline method justCorinna Vinschen2009-09-211-22/+9
| | | | | | | | | | | | | | returning pointer to posix path. (cwdstuff::reset_posix): Convert to non-inline method taking a wchar_t pointer. * path.cc (cwdstuff::set): Revert change from 2009-05-13. Set posix to valid incoming path again. (cwdstuff::reset_posix): New implementation setting posix path from incoming wchar_t path. Explain usage. (cwdstuff::get_posix): Drop implementation. (cwdstuff::get): Drop special case to handle empty posix path. * syscalls.cc (internal_setlocale): Store old posix cwd as wide char path. Restore posix cwd using new charset. Explain why.
* * path.h (INTERIX_SYMLINK_COOKIE): Define.Corinna Vinschen2009-08-261-6/+30
| | | | * path.cc (symlink_info::check_sysfile): Read Interix symlinks as well.
* * mount.cc (fs_info::update): Add comment.Corinna Vinschen2009-08-251-3/+15
| | | | | | | * path.cc (symlink_info::check_reparse_point): Return -1 for volume mount points. Explain why. (symlink_info::check): Call fs.update again for volume mount points. Explain why.
* * globals.cc (ro_u_volume): New R/O unicode string.Corinna Vinschen2009-08-241-2/+9
| | | | | * path.cc (symlink_info::check_reparse_point): Fix check for volume mount points to work on Vista and later as well.
* * fhandler_socket.cc (fhandler_socket::send_internal): Just use wmem size ifChristopher Faylor2009-08-041-1/+1
| | | | | | | | the length exceeds it. * net.cc (fdsock): Use 65535 as window size, just like the comment says or we run into problems with DuplicateHandle. * path.cc (patch_conv::check): Use set_path to set invalid filename. * path.h (path_conv::path_conv): Ditto.
* * cygheap_malloc.h: New file.Christopher Faylor2009-08-011-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * cygheap.h: Remove stuff now included in cygheap_malloc.h and include that file. Make cygheap_init a standard c++ function. Remove unneeded child_info declaration. * path.h: Include cygheap_malloc.h. Remove extra cstrdup declaration. (path_conv): Reorganize to group variables together. (path_conv::path): Make const char *. (path_conv::known_suffix): Ditto. (path_conv::normalized_path): Ditto. (path_conv::path_conv): Reorganize initializers to reflect new element ordering. (path_conv::get_win32): Change return value to const char *. (path_conv::set_path): Move back here from spawn.cc. (parh_conv::modifiable_path): New function. * path.cc (path_conv::add_ext_from_sym): Accommodate const'ness of known_suffixes. (path_conv::set_normalized_path): Ditto for normalized_path. (path_conv::check): Use modifiable_path whereever we need to modify the path element. Use set_path to set the path. (path_conv::~path_conv): Accommodate new const'ness. * spawn.cc (perhaps_suffix): Declare ext as const since that's what is being returned. (path_conv::set_path): Move back to path.h. * winf.f (linebuf): Perform minor cleanup. (linebuf::fromargv): Change second parameter to const. * winf.cc (linebuf::fromargv): Ditto.
* * path.h (class path_conv): Convert path from char array to char *.Corinna Vinschen2009-07-301-25/+29
| | | | | | | | | | | | | | Initialize to NULL in constructors. Drop normalized_path_size member. (path_conv::size): Remove. (path_conv::operator =): Always copy with sizeof path_conv. Always duplicate path on cygheap. (path_conv::set_path): Move implementation to spawn.cc. * path.cc (path_conv::set_normalized_path): Always allocate normalized_path on cygheap. (path_conv::check): Don't work on path, rather allocate THIS_path in TLS and use it throughout. When finished, allocate path on cygheap and copy over. Defer tacking on extension after having copied path. * spawn.cc (path_conv::set_path): Implement here.
* * path.cc (symlink_info::check): Handle STATUS_NOT_SUPPORTED fromCorinna Vinschen2009-07-221-1/+3
| | | | NtCreateFile just like STATUS_EAS_NOT_SUPPORTED.
* * path.cc (symlink_info::check): Fix typo in comment.Corinna Vinschen2009-07-221-1/+1
|
* * globals.cc: Improve comment on R/O UNICODE_STRINGs.Corinna Vinschen2009-07-171-5/+10
| | | | | | | | | | * mount.h (class fs_info): Add is_mvfs bit. * mount.cc (fs_info::update): Recognize MVFS remote filesystem. (fillout_mntent): Reorder filesystem checks for speed. Add mvfs, unixfs, and sunwnfs filesystem types. * path.h (class path_conv): Add fs_is_mvfs method. * path.cc (symlink_worker): On MVFS, always create symlinks as Windows shortcuts. Explain why.
* * path.cc (cwdstuff::set): Only fix up UNC path in win32 so as notCorinna Vinschen2009-07-151-1/+5
| | | | to overwrite incoming path.
* Throughout avoid having to initialize constant UNICODE_STRINGs.Corinna Vinschen2009-07-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | * globals.cc: Define constant UNICODE_STRINGs and store in .rdata section. * fhandler_disk_file.cc: Throughout, use readonly UNICODE_STRINGs rather then initializing local UNICODE_STRING variable where applicable. * fhandler_mem.cc (fhandler_dev_mem::open): Ditto. * flock.cc (inode_t::inode_t): Ditto. * mmap.cc: Ditto. * syscalls.cc: Ditto. * mount.cc (fs_info::update): Ditto. * path.cc: Ditto. * ntdll.h (RtlEqualUnicodePathPrefix): Redefine to take prefix as UNICODE_STRING. (RtlEqualUnicodePathSuffix): Redefine to take suffix as UNICODE_STRING. * fhandler_disk_file.cc: Accommodate throughout. * mount.cc (fs_info::update): Ditto. * path.cc (cwdstuff::set): Ditto. * syscalls.cc: Ditto.
* * path.cc (chdir): Check error conditions first.Corinna Vinschen2009-06-181-5/+5
|
* * path.cc (symlink_info::check): Return with error set to ENOENT ifCorinna Vinschen2009-06-081-1/+2
| | | | STATUS_NO_MEDIA_IN_DEVICE is returned.
* * path.cc (path_conv::check): Don't call set_exec for files on "noacl"Corinna Vinschen2009-06-021-1/+4
| | | | mount points.
* * path.cc (cwdstuff::set): Rewrite previous change to properly test the end ofChristopher Faylor2009-05-291-5/+12
| | | | the buffer.
* * path.cc (cwdstuff::set): Avoid removing a nonexistent trailing slash.Christopher Faylor2009-05-281-5/+8
|
* * cygheap.h (cwdstuff): Convert to class. Make posix and dir private.Corinna Vinschen2009-05-131-3/+25
| | | | | | | | | | | | | | | | | | (cwdstuff::get_posix): New method. (cwdstuff::reset_posix): New method. * dcrt0.cc (dll_crt0_1): Call setlocale rather than _setlocale_r. * environ.cc (environ_init): Ditto. Prefer "C" locale over current codepage default locale. * path.cc (chdir): Use cwdstuff::get_posix method instead of accessing cwdstuff::posix directly. (cwdstuff::set): Defer creating posix path to first usage. (cwdstuff::get_posix): Create posix path if it's empty, and return it. (cwdstuff::get): Create posix path if it's empty. * strfuncs.cc (sys_cp_wcstombs): Use UTF-8 conversion in the "C" locale. (sys_cp_mbstowcs): Ditto. * syscalls.cc (gen_full_path_at): Fetch CWD posix path locked. (setlocale): Implement here. Reset CWD posix path.
* * sec_auth.cc (str2uni_cat): Move from here...Corinna Vinschen2009-05-091-3/+13
| | | | | | | * path.cc (str2uni_cat): ...to here. Simplify. Make static inline. (get_nt_native_path): Use RtlAppendUnicodeToString rather than str2uni_cat for constant strings for speed. * security.h (str2uni_cat): Drop declaration.
* * path.cc (path_conv::get_wide_win32_path): Allow relative paths.Corinna Vinschen2009-04-151-6/+17
| | | | | | (cygwin_conv_path): In case of CCP_POSIX_TO_WIN_W, convert relative paths to absolute paths if the relative pathname length exceeds MAX_PATH.
* * path.cc (symlink_worker): Write target filename as UTF-16 stringCorinna Vinschen2009-03-261-10/+38
| | | | | | | with leading BOM marker. (symlink_info::check_shortcut): If check for leading BOM marker succeeds, read filename as UTF-16 string. (symlink_info::check_sysfile): Ditto.
* * path.cc (warn_msdos): Don't warn about MS-DOS filenames encountered duringChristopher Faylor2009-03-141-1/+1
| | | | initialization.
* * fhandler_disk_file.cc (path_conv::isgood_inode): Move to be definedCorinna Vinschen2009-03-121-1/+4
| | | | | | | | | | | | | earlier. (get_ino_by_handle): Take additional path_conv argument, accommodate throughout. Only use FileId if isgood_inode check is true. (fhandler_base::open_fs): Simplify setting ino due to above change. (readdir_get_ino): Make sure to return always a non-zero inode number. (fhandler_disk_file::readdir): Always open file in dir with FILE_OPEN_REPARSE_POINT so as not to open wrong file. Drop call to isgood_inode here. * path.cc (symlink_info::check): Call fs.update in case we're fetching file information from call to NtQueryDirectoryFile.
* * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fix inode numberCorinna Vinschen2009-01-291-1/+27
| | | | | | | | | | | | | | evaluation for faked "." entry. * mount.cc (fs_info::update): Move setting of is_cdrom after checking for caseinsensitivity. Recognize UDF in is_cdrom case and set caseinsensitive flag according to UDF brokenness determined by OS. Add comment to explain why. * mount.h (class fs_info): Add is_udf status flag. * path.cc (symlink_info::check): Add workaround for UDF bug in terms of casesensitivity on certain OSes. * wincap.h (wincaps::has_broken_udf): New element. (wincaps::has_broken_udf): New element
* * errno.cc (errmap): Set errno to ENOENT instead of ENOSHARE throughout.Corinna Vinschen2009-01-111-4/+4
| | | | | | | * path.cc (path_conv::check): Set to and check for ENOENT instead of ENOSHARE. * path.cc (symlink_info::check): Fix Samba 3.2.x comment.