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 Smith
Subject: Re: [PATCH] Do not assume glibc glob internals
Date: Sat, 23 Sep 2017 17:09:00 -0400

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?



reply via email to

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