aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2022-02-22 13:32:29 +0100
committerCorinna Vinschen <corinna@vinschen.de>2022-02-22 13:33:06 +0100
commitf2dc492df0f310aec97b5fc5847cca8d6cb70a33 (patch)
treebbdb7799317834e5c1495f3e982a01f774d9a4df /winsup/cygwin/syscalls.cc
parent4ec08891a005c040da5bf7c38ae44f932d29bd77 (diff)
downloadnewlib-f2dc492df0f310aec97b5fc5847cca8d6cb70a33.zip
newlib-f2dc492df0f310aec97b5fc5847cca8d6cb70a33.tar.gz
newlib-f2dc492df0f310aec97b5fc5847cca8d6cb70a33.tar.bz2
Cygwin: unlink: filter out virtual files and devices early on
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 661c143..24ec01d 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1123,7 +1123,11 @@ unlink (const char *ourname)
set_errno (EROFS);
goto done;
}
-
+ if (isdevfd_dev (devn) || (win32_name.isdevice () && !win32_name.issocket ()))
+ {
+ set_errno (EPERM);
+ goto done;
+ }
if (!win32_name.exists ())
{
debug_printf ("unlinking a nonexistent file");