summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/child_info.h2
-rw-r--r--winsup/cygwin/fhandler.cc8
-rw-r--r--winsup/cygwin/path.cc4
-rw-r--r--winsup/cygwin/spawn.cc2
5 files changed, 23 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 0e0cc3cd1..ee4695d59 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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>
* cygtls.cc (_cygtls::init_exception_handler): Semi-revert to making
diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h
index 41abe00f6..47afc506a 100644
--- a/winsup/cygwin/child_info.h
+++ b/winsup/cygwin/child_info.h
@@ -125,7 +125,7 @@ public:
cfree (*e);
cfree (moreinfo->envp);
}
- if (type != _PROC_SPAWN)
+ if (type != _PROC_SPAWN && moreinfo->myself_pinfo)
CloseHandle (moreinfo->myself_pinfo);
cfree (moreinfo);
}
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index f47805bde..25f167247 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -590,7 +590,13 @@ fhandler_base::open (int flags, mode_t mode)
create_disposition, create_options, NULL, 0);
if (!NT_SUCCESS (status))
{
- __seterrno_from_nt_status (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);
if (!nohandle ())
goto done;
}
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 39293602e..4c4ce2966 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1,4 +1,4 @@
-/* path.cc: path support.
+ /* path.cc: path support.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007 Red Hat, Inc.
@@ -1101,6 +1101,8 @@ out:
}
else if (!need_directory || error)
/* nothing to do */;
+ else if (fileattr == INVALID_FILE_ATTRIBUTES)
+ strcat (path, "\\"); /* Reattach trailing dirsep in native path. */
else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
path_flags &= ~PATH_SYMLINK;
else
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index aee90753d..e016f1797 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -599,8 +599,6 @@ loop:
myself->exec_sendsig = NULL;
}
res = -1;
- if (moreinfo->myself_pinfo)
- CloseHandle (moreinfo->myself_pinfo);
goto out;
}