From 4c7b82500d0d04a443106f06fee65afda3874bd4 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 22 Jan 2001 20:36:38 +0000 Subject: [PATCH] * path.h: Add a new constant. * syscalls.cc (_read): Oscillate errno check. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/path.cc | 39 +++++---------------------------------- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 91f63fa9d..e663eccaa 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 22 15:35:28 2001 Christopher Faylor + + * path.h: Add a new constant. + * syscalls.cc (_read): Oscillate errno check. + Mon Jan 22 15:27:12 2001 Christopher Faylor * include/cygwin/version.h: Bump API to reflect setlogmask. diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index de13b0572..d86f19464 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -298,7 +298,6 @@ path_conv::check (const char *src, unsigned opt, these operations again on the newly derived path. */ else if (len > 0) { - set_has_symlinks (); if (component == 0 && !need_directory && !(opt & PC_SYM_FOLLOW)) { set_symlink (); // last component of path is a symlink. @@ -316,7 +315,7 @@ path_conv::check (const char *src, unsigned opt, (tail > path_copy && tail[-1] == ':')) goto out; // all done - /* Haven't found an existing pathname component yet. + /* Haven't found a valid pathname component yet. Pinch off the tail and try again. */ *tail = '\0'; component++; @@ -2373,7 +2372,10 @@ symlink_info::check (const char *in_path, const suffix_info *suffixes) /* Not a symlink, see if executable. */ if (!(pflags & PATH_ALL_EXEC) && has_exec_chars (cookie_buf, got)) +{ +debug_printf ("setting exec flag"); pflags |= PATH_EXEC; +} close_and_return: CloseHandle (h); goto file_not_symlink; @@ -2570,41 +2572,10 @@ chdir (const char *dir) native_dir[3] = '\0'; } int res = SetCurrentDirectoryA (native_dir) ? 0 : -1; - if (res == -1) __seterrno (); - else if (!path.has_symlinks ()) - cygcwd.set (path, dir); else - { - char curcwd[MAX_PATH]; - char fulldir[MAX_PATH]; - char *p; - char **tail[MAX_PATH / 2]; - int len = strlen (dir) + 1; - - if (isabspath (dir)) - p = fulldir; - else - { - p = strchr (strcpy (fulldir, cygcwd.get (curcwd)), '\0'); - if (p > fulldir + 1) - strcpy (p++, "/"); - } - strcpy (p, dir); - dir = fulldir; - for (;;) - { - path_conv resolved (dir, PC_SYM_NOFOLLOW | PC_FULL); - if (resolved.get_attributes () & FILE_ATTRIBUTE_DIRECTORY) - { - cygcwd.set (path, dir); - break; - } - char *p = strrchr (dir) - tail[i] = - } - } + cygcwd.set (path, strpbrk (dir, ":\\") != NULL ? NULL : dir); /* Note that we're accessing cwd.posix without a lock here. I didn't think it was worth locking just for strace. */