public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: rmdir: handle /dev in fhandler_dev::rmdir Date: Tue, 19 Jan 2021 09:54:48 +0000 (GMT) [thread overview] Message-ID: <20210119095448.2DC163870883@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=877f0d13f0f6c6cc8b7988951edac73709d82861 commit 877f0d13f0f6c6cc8b7988951edac73709d82861 Author: Corinna Vinschen <corinna@vinschen.de> Date: Tue Jan 19 10:50:36 2021 +0100 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> Diff: --- winsup/cygwin/dir.cc | 2 -- winsup/cygwin/fhandler.h | 1 + winsup/cygwin/fhandler_dev.cc | 7 +++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index f912a9e47..7762557d6 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -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; diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index e1829e28f..af1ef3a45 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -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 *); diff --git a/winsup/cygwin/fhandler_dev.cc b/winsup/cygwin/fhandler_dev.cc index 28b0e3cf0..5fd75a58e 100644 --- a/winsup/cygwin/fhandler_dev.cc +++ b/winsup/cygwin/fhandler_dev.cc @@ -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) {
reply other threads:[~2021-01-19 9:54 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210119095448.2DC163870883@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).