Cygwin: rmdir: handle /dev in fhandler_dev::rmdir

The isdev_dev check in rmdir is unclean.  Create a virtual method
fhandler_dev::rmdir to handle this transparently.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-01-19 10:50:36 +01:00
parent 31ccf40583
commit 877f0d13f0
3 changed files with 8 additions and 2 deletions

View File

@ -410,8 +410,6 @@ rmdir (const char *dir)
set_errno (ENOENT);
else if (has_dot_last_component (dir, false))
set_errno (EINVAL);
else if (isdev_dev (fh->dev ()))
set_errno (ENOTEMPTY);
else if (!fh->rmdir ())
res = 0;
delete fh;

View File

@ -1765,6 +1765,7 @@ public:
int close ();
int __reg2 fstat (struct stat *buf);
int __reg2 fstatvfs (struct statvfs *buf);
int rmdir ();
DIR __reg2 *opendir (int fd);
int __reg3 readdir (DIR *, dirent *);
void rewinddir (DIR *);

View File

@ -107,6 +107,13 @@ fhandler_dev::fstatvfs (struct statvfs *sfs)
return ret;
}
int
fhandler_dev::rmdir ()
{
set_errno (ENOTEMPTY);
return -1;
}
DIR *
fhandler_dev::opendir (int fd)
{