summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
Commit message (Collapse)AuthorAgeFilesLines
* * path.cc (conv_path_list): Use correct value when calculating length to avoidChristopher Faylor2003-06-041-1/+1
| | | | a potential SEGV.
* * path.cc (mount_info::conv_to_win32_path): gcc warning about chroot_ok wasChristopher Faylor2003-05-301-3/+4
| | | | actually valid. Fix it.
* * cygheap.cc (init_cheap): Temporarily remove inline that newer gcc's haveChristopher Faylor2003-05-301-11/+11
| | | | | | problems with. * path.cc (path_conv::check): Rework has_acls logic slightly. Uncouple exec tests away from filesystem tests.
* * mkvers.sh: Avoid "-dontuse" tags.Christopher Faylor2003-05-291-33/+55
| | | | | | | | | | * path.cc (path_conv::check): Set exec state based on known situations. * path.cc (mount_item::fnmunge): New function. (mount_item::build_win32): New function. (mount_info::conv_to_win32_path): Use build_win32 to build windows path. * path.h (mount_item::fnmunge): Declare new function. (mount_item::build_win32): Ditto. * sys/mount.h (MOUNT_ENC): Define.
* Replace ino_t by __ino64_t throughout.Corinna Vinschen2003-05-111-2/+2
|
* * dir.cc (readdir): Fill out new old_d_ino field.Christopher Faylor2003-05-111-1/+1
| | | | | | | | | | | | | | | | * fhandler.h (fhandler_base::namehash): Define as ino_t. (fhandler_base::get_namehash): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Accommodate new 64 bit st_ino. * fhandler_socket.cc (fhandler_socket::fstat): Ditto. * path.cc (hash_path_name): Return ino_t. * syscalls.cc (stat64_to_stat32): Convert 64 bit inode to 32 bit. * winsup.h (hash_path_name): Declare as returning ino_t. * include/cygwin/stat.h (__stat32): Use 32 bit st_ino. (__stat64): Use 64 bit st_ino. * include/cygwin/types.h (__ino64_t): Define. (__ino32_t): Ditto. (ino_t): Define appropriately.
* * errno.cc (_sys_nerr): Fix compile error erroneously checked in on 2003-04-23.Christopher Faylor2003-04-271-1/+1
|
* whitespace cleanupChristopher Faylor2003-03-091-1/+1
|
* * path.h (PATH_LNK): New enum val.Christopher Faylor2003-03-081-3/+5
| | | | | | | | | | | | | | | | | (path_conv::is_lnk_symlink): New function. True if path represents .lnk style symlink. * path.cc (check_shortcut): Set PATH_LNK in pflags when appropriate. (symlink_info::check): Ditto. Remove PATH_LNK from pflags initially. * syscalls.cc (unlink): Always remove readonly attribute from a symlink regardless of type. (link): (from Corinna Vinschen) Allow links to symlinks. Reset attributes on a symlink after successful link creation. (chmod): Use is_lnk_symlink where appropriate. (rename): Ditto. * tty.cc (create_tty_master): Call GetComputerName instead of cygwin_gethostname. Set ut_id. * syscalls.cc (login): Call endutent. (setutent): Do not seek after a fresh open.
* * dtable.cc (dtable::build_fhandler_from_name): Set some fhandlerCorinna Vinschen2003-02-211-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data on sockets to evaluate AF_LOCAL sockets correctly. (dtable::build_fhandler): Set unit number on sockets. * fhandler.h (fhandler_socket): Add unit number. (fhandler_socket::get_unit): New method. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Set unit number. (fhandler_socket::fstat): Reorganize to return more Linux-like values. * net.cc: include ctype.h. (fdsock): Set unit number when building fhandler. * path.cc (path_conv::check): Set device type to FH_SOCKET if file is a AF_UNIX socket. (get_devn): Evaluate unit for virtual socket devices. (win32_device_name): Set windows path for sockets to unix_path with just backslashes to keep the different names. * syscalls.cc (fstat64): Don't override st_ino, st_dev and st_rdev for sockets. (stat_worker): Ditto. From Pierre Humblet: * autoload.cc (AccessCheck): Add. (DuplicateToken): Add. * security.h (check_file_access): Declare. * syscalls.cc (access): Convert path to Windows, check existence and readonly attribute. Call check_file_access instead of acl_access. * security.cc (check_file_access): Create. * sec_acl (acl_access): Delete.
* * path.cc: Change 'to_posix_p' to 'to_posix' throughout.Christopher Faylor2003-02-051-14/+23
| | | | (conv_path_list_buf_size): Accommodate relative paths.
* * path.cc (etc::dir_changed): Fix debug printf.Christopher Faylor2003-02-051-2/+1
|
* * path.cc (symlink): Create security attributes so that only theCorinna Vinschen2003-02-041-1/+1
| | | | | | user can modify the symlink. * security.cc (set_security_attribute): Remove symlink special handling.
* * pwdrp.h (pwdgrp::refresh): Lock entire test prior to reading.Christopher Faylor2003-01-241-1/+2
| | | | | | | | | | | | | | | | | | | * grp.cc (pwdgrp::parse_group): Eliminate arg and use class member instead. Use next_str and next_int to parse arguments. * passwd.cc (pwdgrp::parse_passwd): Ditto. (grab_string): Eliminate. (grab_int): Ditto. * pwdgrp.h (pwdgrp::parse): Eliminate input arg. (pwdgrp::parse_passwd): Reflect above change. (pwdgrp::parse_group): Reflect above change. (pwdgrp::next_str): New function. (pwdgrp::next_int): Ditto. (pwdgrp::gets): Eliminate. * uinfo.cc (pwdgrp::next_str): New function. (pwdgrp::next_int): Ditto. (pwdgrp::add_line): Subsume gets. (pwdgrp::gets): Eliminate. (pwdgrp::load): Just call add_line to parse input buffer.
* * path.h (etc::change_possible): Revert the type to bool.Christopher Faylor2003-01-211-16/+7
| | | | | | | | | | (etc::set_last_modified): Remove obsolete function. * path.cc (etc::change_possible): Revert type to bool. (etc::test_file_change): Do not test for negative values of change_possible and do not set it to -res. (etc::dir_changed): When the handle is NULL, call memset instead of test_file_changed. When the handle is invalid, return true. (etc::file_changed): Remove unneeded check for !fn[n].
* * pwdgrp.h (etc): Move to path.h.Christopher Faylor2003-01-201-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (pwdgrp::max_lines): New field. (pwdgrp::curr_lines): New field. (pwdgrp::pwdgrp_buf): Ditto. (pwdgrp_buf_elem_size): Ditto. (pwdgrp_parse): Ditto. (pwdgrp::gets): Just declare here. (pwdgrp::load): Ditto. Just take one argument. (pwdgrp::load): Define overloaded function accepting passwd buf. (pwdgrp::load): Define overloaded function accepting group buf. * grp.cc: Use pwdgrp elements rather than standalone static variables throughout. (curr_lines): Eliminate. (max_lines): Ditto. (add_grp_line): Ditto. (parse_grp): Define as returning boolean. Accept void * arg and line count. Coerce first argument into __group32 buf reference. Increment curr_line as appropriate. (read_etc_group): Pass pwdgrp buffer to gr.load. * passwd.cc: Use pwdgrp elements rather than standalone static variables throughout. (curr_lines): Eliminate. (max_lines): Ditto. (add_grp_line): Ditto. (parse_passwd): Define as returning boolean. Accept void * arg and line count. Coerce first argument into passwd buf reference. Increment curr_line as appropriate. (read_etc_group): Pass pwdgrp buffer to pr.load. * path.cc (etc::fn): Extend buffer size to allow index by 1 rather than zero. (etc::last_modified): Ditto. (etc::change_possible): Ditto. Renamed from sawchange. Change to signed char since elements are now tri-state. (etc::init): Assume "handle" is 1 based rather than 0. (etc::test_file_change): New function. Sets change_possible based on file date comparison. (etc::dir_changed): Check file states immediately after changed_h is initialized to avoid a race. (etc::file_changed): Use test_file_change to detect if file needs to be updated. * path.h (etc): Move class here from pwdgrp.h. * uinfo.cc: Move etc:: functions to path.cc. Move pwdgrp functions here. (pwdgrp::gets): Eliminate buf checks. Just check eptr and set lptr. (pwdgrp::add_line): New function. (pwdgrp::load): Call generic add_line function which will call correct parser.
* * path.cc (normalize_posix_path): Convert win32 path separators to slashes whenChristopher Faylor2003-01-161-1/+7
| | | | full path is specified.
* * path.cc: Unrevert below reversion except for mount_info::conv_to_posix_pathChristopher Faylor2003-01-101-4/+1
| | | | part.
* * path.cc: Revert patch from 2003-01-09 to normalize a windows pathCorinna Vinschen2003-01-101-4/+6
| | | | rather than converting to posix.
* Split ChangeLog, create ChangeLog-2002.Corinna Vinschen2003-01-101-1/+1
| | | | Fix copyright dates.
* Use isdirsep rather than SLASH_P throughout.Christopher Faylor2003-01-091-22/+22
| | | | | | | | | | * path.cc (iscygdrive): Disallow /cygdrive\x. (normalize_posix_path): "Normalize" a windows path, if detected, rather than converting to posix. * fhandler_serial.cc (fhandler_serial::tcsetattr): Add support and capability checking for B230400 bitrate. (fhandler_serial::tcgetattr): Add support for B230400 bitrate. * include/sys/termios.h: Add B230400 definition for Posix support of 230.4Kbps.
* Remove \n from calls to strace class printfs throughout.Christopher Faylor2002-09-301-1/+1
|
* * environ.cc (environ_init): Avoid a compiler warning.Christopher Faylor2002-09-301-1/+1
| | | | | | | | * path.cc (path_conv::check): Ditto. * path.h (path_conv::operator int): Ditto. * regex/engine.c: Ditto throughout. * regex/regcomp.c: Ditto throughout. * regex/regexec.c: Ditto throughout.
* More GNUify non-GNU formatted functions calls throughout.Christopher Faylor2002-09-231-1/+1
|
* * fhandler.cc (fhandler_base::dup): Don't set handle on failure. Caller hasChristopher Faylor2002-09-221-9/+9
| | | | | | | already taken care of that. * fhandler_console.cc (fhandler_console::open): Initialize handles to NULL. (fhandler_console::close): Ditto. GNUify non-GNU formatted functions calls throughout.
* whitespaceChristopher Faylor2002-09-061-4/+4
|
* * Makefile.in (DLL_OFILES): Drop shortcut.o.Corinna Vinschen2002-09-041-1/+82
| | | | | | | | * path.cc: Move all shortcut functions from shortcut.c to here. (check_shortcut): Implement without using COM interface. * path.h: Move definition of SHORTCUT_HDR_SIZE to here. * shortcut.c: Remove. * shortcut.h: Ditto.
* * path.cc (path_conv::check): Always set fileattr when component == 0.Christopher Faylor2002-07-241-8/+6
| | | | | | | (readlink): Use path_conv method rather than field. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto, throughout. * path.h (path_conv): Make fileattr private. * exceptions.cc (try_to_debug): Default to idle priority when looping.
* * ntdll.h (_SYSTEM_PROCESSOR_TIMES): Force eight byte alignment.Christopher Faylor2002-07-051-34/+36
| | | | (_SYSTEM_TIME_OF_DAY_INFORMATION): Ditto.
* * dtable.cc (cygwin_attach_handle_to_fd): Default to implicit bin mode if noneChristopher Faylor2002-07-031-0/+1
| | | | | | | | specified. * fhandler.cc (fhandler_base::init): Make bin argument a guarantee rather than a suggestion. * path.cc (path_conv::check): Load flag returned from cygwin_conv_to_win32_path into path_flags.
* * fhandler_clipboard.c (fhandler_dev_clipboard::open): Force text mode.Christopher Faylor2002-07-011-1/+9
| | | | | | | | | | | | | | | | * fhandler_console.cc (fhandler_console::open): *Really* force binary mode rather than make it optional. * fhandler_proc.cc (fhandler_proc::open): Ditto. * fhandler_process.cc (fhandler_process::open): Ditto. * fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto. * fhandler_raw.cc (fhandler_dev_raw::open): Ditto. * fhandler_registry.cc (fhandler_registry::open): Ditto. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * fhandler_virtual.cc (fhandler_virtual::open): Ditto. * fhandler_windows.cc (fhandler_windows::open): Ditto. * fhandler_zero.cc (fhandler_dev_zero::open): Ditto. * net.cc (fdsock): Ditto. * path.cc (set_flags): Add more debugging.
* * path.cc (chdir): Minor cleanup.Christopher Faylor2002-06-131-2/+2
|
* fix commentChristopher Faylor2002-06-111-8/+1
|
* * path.cc: Change MOUNT_AUTO to MOUNT_CYGDRIVE throughout.Christopher Faylor2002-06-091-10/+10
| | | | * shared_info.h (CURR_MOUNT_MAGIC): Update.
* * external.cc (cygwin_internal): Make v1 mount table access invalid.Christopher Faylor2002-06-091-81/+0
| | | | | | | | | | * path.cc (mount_info::init): Remove had_to_create_mount_areas initialization. (mount_info::from_registry): Remove v1 table import. (mount_info::read_v1_mounts): Eliminate. (mount_info::import_v1_mounts): Ditto. * shared_info.h (mount_info): Ditto for both of above. * sys/mount.h (MOUNT_DEVFS): New enum. (MOUNT_PROC): Ditto.
* * cygwin.din: Eliminate some newlib wrappers.Christopher Faylor2002-06-061-2/+2
| | | | | | | * path.cc (get_devn): Only consider first 99 potential com devices. (get_device_number): Ditto. * times.cc (_times): Eliminate. (_times): Renamed from times().
* * dtable.cc (handle_to_fn): Attempt to handle "raw" accesses to remote shares.Christopher Faylor2002-06-051-2/+5
| | | | | | * path.cc (mount_info::conv_to_win32_path): Set flags to binary when mount entry is not found. (mount_info::set_flags_from_win32_path): Ditto.
* Remove fcntl.h includes throughout.Christopher Faylor2002-06-051-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fhandler.h: Move fcntl.h include here. (fhandler_base::set_flags): Accept supplied_bin argument. Make non-inlined. * dtable.cc (dtable::init_std_file_from_handle): Just use binmode from pc. (reset_to_open_binmode): Use set_flags. * cygwin.din (open): Avoid newlib wrapper. (read): Ditto. (unlink): Ditto. (write): Ditto. * fhandler.cc (fhandler_base::set_flags): Accept supplied_bin argument. Make binmode decisions here. (fhandler_base::open): Avoid using pc if it is NULL. Eliminate binmode logic. Just call set_flags with binmode argument. (fhandler_base::init): Call set_flags with binmode argument. * fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto. * fhandler_console.cc (fhandler_console::open): Ditto. (fhandler_console::init): Force binary on open. * fhandler_disk_file.cc (fhandler_disk_file::open): Don't set binmode here. Let it happen in base class. * fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode open. Set return value appropriately if unable to open. * fhandler_proc.cc (fhandler_proc::open): Make sure flags are set before open_status. * fhandler_process.cc (fhandler_process::open): Ditto. * fhandler_registry.cc (fhandler_registry::open): Ditto. * fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto. * fhandler_raw.cc (fhandler_dev_raw::open): Force O_BINARY by default. * fhandler_serial.cc (fhandler_serial::init): Ditto. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. (fhandler_pty_master::open): Ditto. * fhandler_virtual.cc (fhandler_virtual::open): Ditto. * fhandler_windows.cc (fhandler_windows::open): Ditto. * fhandler_zero.cc (fhandler_dev_zero::open): Ditto. * net.cc (fdsock): Ditto. * path.cc (path_conv::check): Avoid checking for extension when error or directory. (set_flags): Set PATH_TEXT explicitly, when appropriate. (mount_info::conv_to_win32_path): Use set_flags() to set path flags. * path.h (PATH_TEXT): New enum. (path_conv::binmode): Return appropriate constant based on binmode. * pipe.cc (make_pipe): Set binmode to O_TEXT xor O_BINARY. * syscalls.cc (setmode_helper): Make debugging message a little clearer. (setmode): Set binmode via set_flags.
* * fhandler.cc (fhandler_base::open): Don't set binmode if already set. Don'tChristopher Faylor2002-06-041-1/+1
| | | | | | | | | | | | | check for file. Files should already be set. Report on binary mode for debugging. (fhandler_base::fhandler_base): Don't set default binmode here. That's for later. * fhandler_console.cc (fhandler_console::output_tcsetattr): Don't set binmode, ever, for console. * fhandler_disk_file.cc (fhandler_disk_file::open): Always set the binary mode to the value derived from mount table. * path.cc (mount_info::conv_to_win32_path): Default to binmode if path does not translate into anything in the mount table.
* * path.cc (chdir): Don't allow cd'ing to a non-directory virtual path.Christopher Faylor2002-06-011-0/+5
|
* oopsChristopher Faylor2002-05-311-1/+0
|
* * fhandler_console.cc (fhandler_console::open): Reinstate setting of flags.Christopher Faylor2002-05-311-1/+1
|
* * path.cc (path_conv::check): Set fileattr to INVALID_FILE_ATTRIBUTES forChristopher Faylor2002-05-311-1/+9
| | | | | | nonexistent virtual device path. (chdir): Set correct errno when attempt is made to cd to nonexistent virtual device path.
* * autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro.Christopher Faylor2002-05-281-20/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (LoadFuncEx2): Adapted from LoadFuncEx. Provides control of return value for nonexistent function. (NtQueryObject): Declare. (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not available. * debug.h (being_debugged): Just rely on IsDebuggerPresent return value. * dtable.cc (handle_to_fn): New function. (dtable::init_std_file_from_handle): Attempt to derive std handle's name via handle_to_fn. (dtable::build_fhandler_from_name): Fill in what we can in path_conv structure when given a handle and path doesn't exist. * fhandler.cc (fhandler_base::open): Don't set the file pointer here. Use pc->exists () to determine if file exists rather than calling GetFileAttributes again. * fhandler.h (fhandler_base::exec_state_isknown): New method. (fhandler_base::fstat_helper): Add extra arguments to declaration. (fhandler_base::fstat_by_handle): Declare new method. (fhandler_base::fstat_by_name): Declare new method. * fhandler_disk_file (num_entries): Make __stdcall. (fhandler_base::fstat_by_handle): Define new method. (fhandler_base::fstat_by_name): Define new method. (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate. (fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat structure. Move handle or name specific stuff to new methods above. (fhandler_disk_file::open): Use real_path->exists rather than calling GetFileAttributes again. * ntdll.h (FILE_NAME_INFORMATION): Define new structure. (OBJECT_INFORMATION_CLASS): Partially define new enum. (OBJECT_NAME_INFORMATION): Define new structure. (NtQueryInformationFile): New declaration. (NtQueryObject): New declaration. * path.cc (path_conv::fillin): Define new method. * path.h (path_conv::fillin): Declare new method. (path_conv::drive_thpe): Rename from 'get_drive_type'. (path_conv::volser): Declare new method. (path_conv::volname): Declare new method. (path_conv::root_dir): Declare new method. * syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
* Remove unneeded sync.h, where appropriate, throughout. Remove unneeded heap.h,Christopher Faylor2002-05-251-1/+0
| | | | | | where appropriate, throughout. Remove unneeded exceptions.h, where appropriate, throughout. Remove unneeded perprocess.h, where appropriate, throughout.
* * dtable.cc (dtable::build_fhandler_from_name): Just pass posix path along toChristopher Faylor2002-05-241-15/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | set_name via return_and_clear_normalized_path. (dtable::build_fhandler): New method with const char * argument. (dtable::reset_unix_path_name): Eliminate. (dtable::dup_worker): Use correct build_fhandler method. * mmap.cc (mmap_record::alloc_fh): Ditto. * dtable.h (dtable::build_fhandler): New method. (dtable::reset_unix_path_name): Eliminate. * fhandler.cc (fhandler_base::set_name): Assume that unix_name has already been cmalloced. (fhandler_base::reset_unix_path_name): Eliminate. (fhandler_base::~fhandler_base): Coercion for cfree. * fhandler.h (fhandler_base::unix_path_name): Make const char *. (fhandler_base::win32_path_name): Ditto. (fhandler_base::reset_unix_path_name): Eliminate. * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate const char *ness of win32_path_name. * fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name requirements. * path.cc (path_conv::return_and_clear_normalized_path): New method. (path_conv::clear_normalized_path): Eliminate. (path_conv::~path_conv): Ditto. (path_conv::check): Accommodate new build_fhandler method. * path.h (path_conv::~path_conv): Eliminate. (path_conv::clear_normalized_path): Ditto. (path_conv::return_and_clear_normalized_path): Declare new method.
* * path.cc (path_conv::check): Make sure any trailing path component is part ofChristopher Faylor2002-05-231-1/+5
| | | | potential normalized posix path.
* * fhandler.h (fhandler_virtual::exists): Eliminate path argument.Christopher Faylor2002-05-221-2/+5
| | | | | | | | | | | | | | (fhandler_proc::exists): Ditto. (fhandler_registry::exists): Ditto. (fhandler_process::exists): Ditto. * fhandler_proc.cc (fhandler_proc::exists): Ditto. Use built-in name. * fhandler_process.cc (fhandler_process::exists): Ditto. (fstat): Ditto. * fhandler_registry.cc (fhandler_registry::exists): Ditto. (fhandler_registry::fstat): Ditto. * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto. * path.cc (path_conv::check): Ditto. Add debugging. * syscalls.cc (dup): Always call dup2 for error handling.
* * path.cc (path_conv::check): Always set executable bit for executableChristopher Faylor2002-05-181-1/+1
| | | | extension.
* * fhandler.h (executable_states): For now, make dont_care_if_executableChristopher Faylor2002-05-121-45/+46
| | | | | | | | | | equivalent to not_executable. * sys/mount.h: Define MOUNT_NOTEXEC. * path.h (fs_info): New class. (path_conv): Move fs-specific fields to new 'fs' structure. (path_conv::update_fs_info): Move to fs_info and rename to just 'update'. * path.cc (fs_info::update): Ditto. Return 'true' if successful. (fillout_mntent): Add ',noexec' to list of reported options.