summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* * 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.
* * mount.cc (mount_info::from_fstab_line): Always convert driveCorinna Vinschen2009-01-091-24/+21
| | | | | | | | | letter in native path to uppercase. * path.cc (normalize_win32_path): Ditto. (path_prefix_p): Revert previous patch. * path.cc (symlink_info::check): Check for STATUS_INVALID_PARAMETER return code to circumvent weird behaviour of Samba 3.2.x shares.
* * include/sys/cygwin.h (CW_SETERRNO): Define.Christopher Faylor2009-01-091-2/+14
| | | | | | | | | * external.cc (CW_SETERRNO): Implement. * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 192 to reflect the above change. * path.cc (path_prefix_p): Treat X: as equivalent to x:. * mkglobals_h: Remove unneeded #define. * spawn.cc (spawn_guts): Avoid overly wordy initialization to zero.
* * fhandler_disk_file.cc (fhandler_disk_file::link): Only add .exe ifCorinna Vinschen2009-01-071-1/+2
| | | | | | original file has .exe as well. * path.cc (path_conv::is_binary): Only recognize Windows 32 and 64 bit apps as binaries.
* Remove unneeded header files from source files throughout. Update copyrightsChristopher Faylor2009-01-031-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | where appropriate. * globals.cc: New file for generic global variables. * mkglobals_h: New file to generate globals.h. * mkstatic: New Script used to build a (currently non-working) static libcygwin_s.a. * Makefile.in: Add unused rule to build a non-working libcygwin_s.a. (DLL_OFILES): Add globals.o. Make all objects rely on globals.h. (globals.h): New target. Generate globals.h. * cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE operator is allowed in _cygtls. * dcrt0.cc: Move most globals to globals.cc. * init.cc: Ditto. * environ.cc (strip_title_path): Remove now-unneeded extern. * fhandler_serial.cc (fhandler_serial::open): Ditto. * pinfo.cc: Ditto. (commune_process): Ditto. * shared.cc: Ditto. * glob.cc: Ditto. * strace.cc: Ditto. * exceptions.cc: Define CYGTLS_HANDLE before including winsup.h. * path.cc (stat_suffixes): Move here. * security.h: Add forward class path_conv declaration. * smallprint.cc (__small_vsprintf): Make a true c++ function. (__small_sprintf): Ditto. (small_printf): Ditto. (console_printf): Ditto. (__small_vswprintf): Ditto. (__small_swprintf): Ditto. * spawn.cc (spawn_guts): Remove _stdcall decoration in favor of regparm. (hExeced): Move to globals.cc * strfuncs.cc (current_codepage): Ditto. (active_codepage): Ditto. * sync.cc (lock_process::locker): Move here from dcrt0.cc. * syscalls.cc (stat_suffixes): Move to path.cc. * tty.cc (tty::create_master): Uncapitalize fatal warning for consistency. * winsup.h: Include globals.h to declare most of the grab bag list of globals which were previously defined here. * mount.h: Move USER_* defines back to shared_info.h. * speclib: Force temporary directory cleanup.
* * mount.cc: Change comment.Christopher Faylor2008-12-251-195/+0
| | | | | | | | | | | | (smb_extended_info): Move here from path.cc. (fs_info::update): Ditto. (mount_info::create_root_entry): Delay conversion to slashes and use passed in buffer to figure out fs type. * path.cc (smb_extended_info): Move. (fs_info::update): Ditto. * mount.h: New file. Move mount information here. * path.h: (fs_info::update): Move. * shared_info.h (mount_item): Ditto.
* * path.cc (symlink_info::check_shortcut): Ensure that symlink handle is closedChristopher Faylor2008-12-241-2/+1
| | | | on successful return.
* * path.cc (path_conv::check): Handle incoming DOS paths non-POSIXy,Corinna Vinschen2008-12-191-1/+9
| | | | always case-insensitive, always ignoring ACLs.
* * path.cc (symlin_info::check): Set 4th parameter ofCorinna Vinschen2008-12-181-23/+26
| | | | | | | | NtQueryDirectoryFile to NULL instead of 0 since it's a pointer. Simplify label and break from loop handling in symlink evaluation conditional expression. Drop a now useless break statement. Fix behaviour when searching for `foo' and then finding a `foo.lnk' which is no shortcut.
* * fhandler_disk_file.cc (readdir_get_ino): Don't complain about MS-DOS pathsChristopher Faylor2008-12-141-1/+1
| | | | since the function could be fed one by an internal call.
* Remove unneeded whitespace.Christopher Faylor2008-11-261-9/+14
| | | | | | | | | | | | | | | | * fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be set to ENXIO when opening a fifo write/nonblocking. * environ.cc (ucreqenv): Rename to ucenv. Move code from old ucenv here and conditionalize it on create_upcaseenv. (ucenv): Delete. (environ_init): Fix compiler warning by moving create_upcaseenv test to ucenv. Don't bother checking for child_proc_info when calling ucenv since it is assumed to be NULL at the point where the function is called. * path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing with devices since the device handler passes in a translated MS-DOS path. * sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which causes a compiler error. * fhandler_netdrive.cc: Update copyright.
* * mount.cc (mount_info::cygdrive_win32_path): Always upper caseCorinna Vinschen2008-11-111-1/+8
| | | | | | | DOS drive letter to accommodate case sensitivity. (cygdrive_getmntent): Ditto. * path.cc (path_conv::check): Invalidate wide_path after making path relative.
* * path.cc (normalize_win32_path): Don't add a trailing '\' if the cwd returns aChristopher Faylor2008-11-111-1/+2
| | | | path with a trailing '\'.
* * ntdll.h (NtSetAttributesFile): New inline function.Corinna Vinschen2008-10-201-12/+3
| | | | | | | | | * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Use NtSetAttributesFile. * path.cc (symlink_worker): Ditto. * syscalls.cc (unlink_nt): Ditto. (rename): Omit FILE_SHARE_DELETE when opening files on Samba. Add comment to explain why.
* * fhandler_disk_file.cc (fhandler_base::fstat_helper): CheckCorinna Vinschen2008-10-091-11/+0
| | | | | | for executable suffixes here in case we're on a file system not supporting permission. * path.cc (path_conv::check): Drop check for executable suffixes.
* * path.cc (path_conv::is_binary): Always check for GetBinaryType.Corinna Vinschen2008-10-091-5/+2
| | | | | * syscalls.cc (rename): Fix test for just changing case of name on case insensitive filesystems.