Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-12-19 05:40:40 +0300
committerChristopher Faylor <me@cgf.cx>2004-12-19 05:40:40 +0300
commit5524af6e9bf23505139adf7152a22b4a0a65f66d (patch)
tree3119f31bf7c2a268856c89a72de43852402adbbe /winsup
parentbbe009b770de67ebe7f92118d43f46f753f0fb21 (diff)
* child_info.h (CURR_CHILD_INFO_MAGIC): Use updated value.
* path.cc (path_conv::check): Check the output Win32 path for trailing spaces and dots, not the input path. Disallow all use of foo./bar since consistently getting this right is time consuming. Remove strange test for "unc\" since no one seems to know what it's for.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/child_info.h2
-rw-r--r--winsup/cygwin/path.cc45
3 files changed, 42 insertions, 17 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 912a12d3a..051c5ff28 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,15 @@
+2004-12-18 Christopher Faylor <cgf@timesys.com>
+
+ * child_info.h (CURR_CHILD_INFO_MAGIC): Use updated value.
+
+2004-12-18 Christopher Faylor <cgf@timesys.com>
+ Pierre Humblet <pierre.humblet@ieee.org>
+
+ * path.cc (path_conv::check): Check the output Win32 path for trailing
+ spaces and dots, not the input path. Disallow all use of foo./bar
+ since consistently getting this right is time consuming. Remove
+ strange test for "unc\" since no one seems to know what it's for.
+
2004-12-18 Chris January <chris@atomice.net>
* fhandler_proc.cc (proc_listing): Add entry for "self".
diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h
index 601fdfd8b..97cf455e2 100644
--- a/winsup/cygwin/child_info.h
+++ b/winsup/cygwin/child_info.h
@@ -29,7 +29,7 @@ enum child_info_types
#define EXEC_MAGIC_SIZE sizeof(child_info)
-#define CURR_CHILD_INFO_MAGIC 0x694cd4b8U
+#define CURR_CHILD_INFO_MAGIC 0x17ad771aU
/* NOTE: Do not make gratuitous changes to the names or organization of the
below class. The layout is checksummed to determine compatibility between
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 2e4c725c7..55b40020e 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -546,25 +546,12 @@ path_conv::check (const char *src, unsigned opt,
/* Detect if the user was looking for a directory. We have to strip the
trailing slash initially while trying to add extensions but take it
into account during processing */
- if (tail > path_copy + 1)
+ if (tail > path_copy + 1 && isslash (tail[-1]))
{
- if (isslash (tail[-1]))
- {
- need_directory = 1;
- tail--;
- }
- /* Remove trailing dots and spaces which are ignored by Win32 functions but
- not by native NT functions. */
- while (tail[-1] == '.' || tail[-1] == ' ')
- tail--;
- if (tail > path_copy + 1 && isslash (tail[-1]))
- {
- error = ENOENT;
- return;
- }
+ need_directory = 1;
+ *--tail = '\0';
}
path_end = tail;
- *tail = '\0';
/* Scan path_copy from right to left looking either for a symlink
or an actual existing file. If an existing file is found, just
@@ -835,6 +822,32 @@ out:
if (dev.devn == FH_FS)
{
+ if (strncmp (path, "\\\\.\\", 4))
+ {
+ /* Windows ignores trailing dots and spaces */
+ char *tail = NULL;
+ for (char *p = path; *p; p++)
+ if (*p != '.' && *p != ' ')
+ tail = NULL;
+ else if (p[1] == '\\')
+ {
+ error = ENOENT;
+ return;
+ }
+ else if (!tail)
+ tail = p;
+
+ if (!tail)
+ /* nothing */;
+ else if (tail[-1] != '\\')
+ *tail = '\0';
+ else
+ {
+ error = ENOENT;
+ return;
+ }
+ }
+
if (fs.update (path))
{
debug_printf ("this->path(%s), has_acls(%d)", path, fs.has_acls ());