aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-04-26 05:13:32 +0000
committerChristopher Faylor <me@cgf.cx>2000-04-26 05:13:32 +0000
commit55fc91b9d62bec29deaba79e4adb4e85c35cc306 (patch)
tree149fe493e1a30834ca2dd732e5f30d01f0675c91 /winsup/cygwin/path.cc
parent47eaa6c421031e7f908eb352ebe6905b2d8bcb27 (diff)
downloadnewlib-55fc91b9d62bec29deaba79e4adb4e85c35cc306.zip
newlib-55fc91b9d62bec29deaba79e4adb4e85c35cc306.tar.gz
newlib-55fc91b9d62bec29deaba79e4adb4e85c35cc306.tar.bz2
* exceptions.cc (interruptible): Allocate slightly more space for directory
name check. Windows 95 seems to null-terminate the directory otherwise. (interrupt_on_return): Issue a fatal error if we can't find the caller's stack. * spawn.cc (find_exec): Accept a path_conv argument rather than a buffer so that the caller can find things out about a translated path. (perhaps_suffix): Ditto. (spawn_guts): Allocate path_conv stuff here so that we can find out stuff about the translated path (this is work in progress). * environ.cc (environ_init): Accept an as-yet unused argument indicating whether we were invoked from a cygwin parent or not. (winenv): Ditto. (posify): Accept an argument indicating whether the path has already been translated. * dlfcn.cc (check_access): Provide a path_conv buffer to find_exec. * exec.cc (sexecvpe): Ditto. * path.cc (path_conv::check): Rename from path_conv::path_conv. (mount_item::getmntent): Recognize "Cygwin executable" bit. (symlink_info::check): Remove debugging statements. * path.h (class path_conv): Add iscygexec method. Rewrite constructor to call "check" method to allow multiple operations on a path_conv variable. * pinfo.cc (pinfo_init): Pass argument to environ_init. * shared.h: Bump PROC_MAGIC. * winsup.h: Reflect above changes to function arguments. * include/sys/mount.h: Add MOUNT_CYGWIN_EXEC type.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 30aa3f9..c189890 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -186,8 +186,9 @@ path_prefix_p_ (const char *path1, const char *path2, int len1)
SYMLINK_CONTENTS - just return symlink contents
*/
-path_conv::path_conv (const char *src, symlink_follow follow_mode,
- int use_full_path, const suffix_info *suffixes)
+void
+path_conv::check (const char *src, symlink_follow follow_mode,
+ int use_full_path, const suffix_info *suffixes)
{
/* This array is used when expanding symlinks. It is MAX_PATH * 2
in length so that we can hold the expanded symlink plus a
@@ -1891,9 +1892,12 @@ mount_item::getmntent ()
else
strcpy (cygwin_shared->mount.mnt_opts, (char *) "binmode");
- if (flags & MOUNT_EXEC)
+ if (flags & MOUNT_CYGWIN_EXEC)
+ strcat (cygwin_shared->mount.mnt_opts, (char *) ",cygexec");
+ else if (flags & MOUNT_EXEC)
strcat (cygwin_shared->mount.mnt_opts, (char *) ",exec");
+
ret.mnt_opts = cygwin_shared->mount.mnt_opts;
ret.mnt_freq = 1;
@@ -2190,9 +2194,6 @@ symlink_info::check (const char *in_path, const suffix_info *suffixes)
h = CreateFileA (path, GENERIC_READ, FILE_SHARE_READ, &sec_none_nih, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
-
-syscall_printf ("opened '%s'(%p)", path, h);
-
res = -1;
if (h == INVALID_HANDLE_VALUE)
__seterrno ();
@@ -2201,7 +2202,6 @@ syscall_printf ("opened '%s'(%p)", path, h);
char cookie_buf[sizeof (SYMLINK_COOKIE) - 1];
DWORD got;
-syscall_printf ("ReadFile");
if (! ReadFile (h, cookie_buf, sizeof (cookie_buf), &got, 0))
set_errno (EIO);
else if (got == sizeof (cookie_buf)
@@ -2238,18 +2238,16 @@ syscall_printf ("ReadFile");
else
{
/* Not a symlink, see if executable. */
- if (!(pflags & PATH_EXEC) && got >= 2 &&
+ if (!(pflags & (PATH_EXEC | PATH_CYGWIN_EXEC)) && got >= 2 &&
((cookie_buf[0] == '#' && cookie_buf[1] == '!') ||
(cookie_buf[0] == ':' && cookie_buf[1] == '\n')))
pflags |= PATH_EXEC;
close_and_return:
-syscall_printf ("close_and_return");
CloseHandle (h);
goto file_not_symlink;
}
}
-syscall_printf ("breaking from loop");
CloseHandle (h);
break;
}