* dir.cc (rmdir): Report ENOENT when file doesn't exist rather than ENOTDIR.

This commit is contained in:
Christopher Faylor
2001-08-28 20:38:07 +00:00
parent 34971f0f8c
commit ffe94510f5
3 changed files with 27 additions and 9 deletions

View File

@@ -352,9 +352,15 @@ rmdir (const char *dir)
goto done;
}
/* Does the file exist? */
if (real_dir.file_attributes () == (DWORD) -1)
{
set_errno (ENOENT);
goto done;
}
/* Is `dir' a directory? */
if (real_dir.file_attributes () == (DWORD) -1 ||
!(real_dir.file_attributes () & FILE_ATTRIBUTE_DIRECTORY))
if (!(real_dir.file_attributes () & FILE_ATTRIBUTE_DIRECTORY))
{
set_errno (ENOTDIR);
goto done;