bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Do not assume glibc glob internals


From: Paul Eggert
Subject: Re: [PATCH] Do not assume glibc glob internals
Date: Sat, 23 Sep 2017 23:27:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

Paul Smith wrote:
Thanks for this patch, Paul.

One question:

On Sun, 2017-09-10 at 09:40 -0700, Paul Eggert wrote:
+  /* Make sure the parent of "." exists and is a directory, not a
+     file.  This is because 'lstat' on Windows normalizes the argument
+     foo/. => foo without checking first that foo is a directory.  */
+  if (plen > 1 && path[plen - 1] == '.'
+      && (path[plen - 2] == '/' || path[plen - 2] == '\\'))
+    {
+      char parent[MAXPATHLEN];
+
+      strncpy (parent, path, plen - 2);

If it's true that Windows normalizes the argument, why do we need to
make a copy of the prefix of path?  Wouldn't we get the same behavior if
we sent the original path string to lstat(), and just tested ISDIR
afterwards?


Yes, that sounds right. I copied that boilerplate from local_stat, so local_stat could be simplified too.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]