summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-06-05 16:01:55 +0000
committerChristopher Faylor <me@cgf.cx>2002-06-05 16:01:55 +0000
commitea4e6ec8f9fe4a784d4ce2ef71037e05fb9a876d (patch)
treef29a1b8689d3bc188ebc5d6822c1cbdb562e266d /winsup/cygwin/syscalls.cc
parent2bb6b3e50619d10b93a8a2640dd4784e01e97236 (diff)
downloadcygnal-ea4e6ec8f9fe4a784d4ce2ef71037e05fb9a876d.tar.gz
cygnal-ea4e6ec8f9fe4a784d4ce2ef71037e05fb9a876d.tar.bz2
cygnal-ea4e6ec8f9fe4a784d4ce2ef71037e05fb9a876d.zip
* dir.cc (rmdir): Streamline. Detect attempts to remove directories from
"read-only" virtual devices. (Suggested by Pavel Tsekov) * syscalls.cc (unlink): Detect attempts to remove directories from "read-only" virtual devices. (From Pavel Tsekov)
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 9e28d104e..bf2709d06 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -94,6 +94,7 @@ extern "C" int
_unlink (const char *ourname)
{
int res = -1;
+ DWORD devn;
sigframe thisframe (mainthread);
path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL);
@@ -104,6 +105,13 @@ _unlink (const char *ourname)
goto done;
}
+ if ((devn = win32_name.get_devn ()) == FH_PROC || devn == FH_REGISTRY
+ || devn == FH_PROCESS)
+ {
+ set_errno (EROFS);
+ goto done;
+ }
+
syscall_printf ("_unlink (%s)", win32_name.get_win32 ());
if (!win32_name.exists ())