* child_info.h (~child_info_spawn): Check moreinfo->myself_pinfo for

NULL before closing.
	* spawn.cc (spawn_guts): Don't close moreinfo->myself_pinfo explicitely
	in case of failing CloseProcess.

	* fhandler.cc (fhandler_base::open_): Return EISDIR when trying to
	create a directory.
	* path.cc (path_conv::check): If input path had a trailing dir
	separator, tack it on to the native path if directory doesn't exist.
This commit is contained in:
Corinna Vinschen 2008-03-05 18:31:09 +00:00
parent e3bf57046b
commit 8a889eff57
5 changed files with 23 additions and 5 deletions

View File

@ -1,3 +1,15 @@
2008-03-05 Corinna Vinschen <corinna@vinschen.de>
* child_info.h (~child_info_spawn): Check moreinfo->myself_pinfo for
NULL before closing.
* spawn.cc (spawn_guts): Don't close moreinfo->myself_pinfo explicitely
in case of failing CloseProcess.
* fhandler.cc (fhandler_base::open_): Return EISDIR when trying to
create a directory.
* path.cc (path_conv::check): If input path had a trailing dir
separator, tack it on to the native path if directory doesn't exist.
2008-03-02 Christopher Faylor <me+cygwin@cgf.cx> 2008-03-02 Christopher Faylor <me+cygwin@cgf.cx>
* cygtls.cc (_cygtls::init_exception_handler): Semi-revert to making * cygtls.cc (_cygtls::init_exception_handler): Semi-revert to making

View File

@ -125,7 +125,7 @@ public:
cfree (*e); cfree (*e);
cfree (moreinfo->envp); cfree (moreinfo->envp);
} }
if (type != _PROC_SPAWN) if (type != _PROC_SPAWN && moreinfo->myself_pinfo)
CloseHandle (moreinfo->myself_pinfo); CloseHandle (moreinfo->myself_pinfo);
cfree (moreinfo); cfree (moreinfo);
} }

View File

@ -590,6 +590,12 @@ fhandler_base::open (int flags, mode_t mode)
create_disposition, create_options, NULL, 0); create_disposition, create_options, NULL, 0);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
/* Trying to open a directory should return EISDIR, not ENOENT. */
PUNICODE_STRING upath = pc.get_nt_native_path ();
if (status == STATUS_OBJECT_NAME_INVALID
&& upath->Buffer[upath->Length / sizeof (WCHAR) - 1] == '\\')
set_errno (EISDIR);
else
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
if (!nohandle ()) if (!nohandle ())
goto done; goto done;

View File

@ -1,4 +1,4 @@
/* path.cc: path support. /* path.cc: path support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007 Red Hat, Inc. 2006, 2007 Red Hat, Inc.
@ -1101,6 +1101,8 @@ out:
} }
else if (!need_directory || error) else if (!need_directory || error)
/* nothing to do */; /* nothing to do */;
else if (fileattr == INVALID_FILE_ATTRIBUTES)
strcat (path, "\\"); /* Reattach trailing dirsep in native path. */
else if (fileattr & FILE_ATTRIBUTE_DIRECTORY) else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
path_flags &= ~PATH_SYMLINK; path_flags &= ~PATH_SYMLINK;
else else

View File

@ -599,8 +599,6 @@ loop:
myself->exec_sendsig = NULL; myself->exec_sendsig = NULL;
} }
res = -1; res = -1;
if (moreinfo->myself_pinfo)
CloseHandle (moreinfo->myself_pinfo);
goto out; goto out;
} }