From 99138976d9f0e9f94e9920af5e61ace9fd5554df Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 24 Jul 2002 05:37:47 +0000 Subject: * path.cc (path_conv::check): Always set fileattr when component == 0. (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. --- winsup/cygwin/ChangeLog | 9 +++++++++ winsup/cygwin/exceptions.cc | 2 +- winsup/cygwin/fhandler_disk_file.cc | 6 +++--- winsup/cygwin/path.cc | 14 ++++++-------- winsup/cygwin/path.h | 6 +++--- 5 files changed, 22 insertions(+), 15 deletions(-) (limited to 'winsup') diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 40bbf682c..cefd7e750 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2002-07-24 Christopher Faylor + + * path.cc (path_conv::check): Always set fileattr when component == 0. + (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. + 2002-07-23 Corinna Vinschen * fhandler_serial.cc: Use must_init_serial_line capability throughout. diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 764ae5a84..f907b21a4 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -391,9 +391,9 @@ try_to_debug (bool waitloop) system_printf ("Failed to start debugger: %E"); else { + SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE); if (!waitloop) return 1; - SetThreadPriority (hMainThread, THREAD_PRIORITY_IDLE); while (!being_debugged ()) /* spin */; Sleep (4000); diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 95081f061..738416fbf 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -260,7 +260,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, buf->st_mode = 0; /* Using a side effect: get_file_attibutes checks for directory. This is used, to set S_ISVTX, if needed. */ - if (pc->fileattr & FILE_ATTRIBUTE_DIRECTORY) + if (pc->isdir ()) buf->st_mode = S_IFDIR; else if (pc->issymlink ()) buf->st_mode = S_IFLNK; @@ -273,7 +273,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, &uid, &gid) == 0) { /* If read-only attribute is set, modify ntsec return value */ - if ((pc->fileattr & FILE_ATTRIBUTE_READONLY) && !get_symlink_p ()) + if (pc->has_attribute (FILE_ATTRIBUTE_READONLY) && !get_symlink_p ()) buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); if (!(buf->st_mode & S_IFMT)) @@ -283,7 +283,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, { buf->st_mode |= STD_RBITS; - if (!(pc->fileattr & FILE_ATTRIBUTE_READONLY)) + if (!pc->has_attribute (FILE_ATTRIBUTE_READONLY)) buf->st_mode |= STD_WBITS; /* | S_IWGRP | S_IWOTH; we don't give write to group etc */ diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index c09b4591f..f4527afd8 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -447,7 +447,6 @@ path_conv::check (const char *src, unsigned opt, error = 0; else if ((error = check_null_empty_str (src))) return; - /* This loop handles symlink expansion. */ for (;;) { @@ -603,7 +602,10 @@ path_conv::check (const char *src, unsigned opt, if (!(opt & PC_SYM_IGNORE)) { if (!component) - path_flags = sym.pflags; + { + fileattr = sym.fileattr; + path_flags = sym.pflags; + } /* If symlink.check found an existing non-symlink file, then it sets the appropriate flag. It also sets any suffix found @@ -612,10 +614,7 @@ path_conv::check (const char *src, unsigned opt, { error = sym.error; if (component == 0) - { - fileattr = sym.fileattr; - add_ext_from_sym (sym); - } + add_ext_from_sym (sym); if (pcheck_case == PCHECK_RELAXED) goto out; // file found /* Avoid further symlink evaluation. Only case checks are @@ -633,7 +632,6 @@ path_conv::check (const char *src, unsigned opt, if (component == 0 && !need_directory && !(opt & PC_SYM_FOLLOW)) { set_symlink (); // last component of path is a symlink. - fileattr = sym.fileattr; if (opt & PC_SYM_CONTENTS) { strcpy (path, sym.contents); @@ -3072,7 +3070,7 @@ readlink (const char *path, char *buf, int buflen) if (!pathbuf.issymlink ()) { - if (pathbuf.fileattr != INVALID_FILE_ATTRIBUTES) + if (pathbuf.exists ()) set_errno (EINVAL); return -1; } diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 3d9b86c15..f9f55035e 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -70,6 +70,7 @@ struct fs_info class path_conv { char path[MAX_PATH]; + DWORD fileattr; fs_info fs; void add_ext_from_sym (symlink_info&); public: @@ -79,7 +80,6 @@ class path_conv int error; DWORD devn; int unit; - DWORD fileattr; BOOL case_clash; char *normalized_path; @@ -138,8 +138,8 @@ class path_conv check (src, opt | PC_NULLEMPTY, suffixes); } - path_conv (): path_flags (0), known_suffix (NULL), error (0), devn (0), - unit (0), fileattr (INVALID_FILE_ATTRIBUTES), + path_conv (): fileattr (INVALID_FILE_ATTRIBUTES), path_flags (0), + known_suffix (NULL), error (0), devn (0), unit (0), normalized_path (NULL) {path[0] = '\0';} inline char *get_win32 () { return path; } -- cgit v1.2.3