* 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.
This commit is contained in:
Christopher Faylor
2000-04-26 05:13:32 +00:00
parent 47eaa6c421
commit 55fc91b9d6
12 changed files with 110 additions and 64 deletions

View File

@ -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;
}