Eric Blake <e...@byu.net> 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."