bug-gnulib
[Top][All Lists]
Advanced

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

Re: mingw remove bug


From: Ben Pfaff
Subject: Re: mingw remove bug
Date: Mon, 14 Sep 2009 16:51:33 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> +  if (lstat (name, &st) == 0 && S_ISDIR (st.st_mode))
> +    {
> +      /* Mingw rmdir("empty/.") mistakenly succeeds.  */
> +      while (ISSLASH (name[len - 1]))
> +        len--;
> +      if (name[len - 1] == '.' && (1 == len || ISSLASH (name[len - 2])))
> +        {
> +          errno = EINVAL;
> +          return -1;
> +        }
> +      return rmdir (name);
> +    }
> +  /* Mingw remove("file/") fails with EINVAL, instead of the required
> +     ENOTDIR.  */
> +  if (ISSLASH (name[len - 1]))
> +    {
> +      errno = ENOTDIR;
> +      return -1;
> +    }

I believe that this will return ENOTDIR for a file whose name
ends in '/' or '\' and on which lstat() fails (e.g. for a file
that doesn't exist).
-- 
"I didn't say it was your fault.
 I said I was going to blame it on you."





reply via email to

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