Cygwin: unlink: filter out virtual files and devices early on
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
4ec08891a0
commit
f2dc492df0
|
@ -433,6 +433,7 @@ extern const _device dev_fs_storage;
|
||||||
#define iscygdrive_dev(devn) (devn == FH_CYGDRIVE)
|
#define iscygdrive_dev(devn) (devn == FH_CYGDRIVE)
|
||||||
|
|
||||||
#define isdev_dev(devn) (devn == FH_DEV)
|
#define isdev_dev(devn) (devn == FH_DEV)
|
||||||
|
#define isdevfd_dev(devn) (devn == FH_DEV_FD)
|
||||||
|
|
||||||
#define isprocsys_dev(devn) (devn == FH_PROCSYS)
|
#define isprocsys_dev(devn) (devn == FH_PROCSYS)
|
||||||
|
|
||||||
|
|
|
@ -1123,7 +1123,11 @@ unlink (const char *ourname)
|
||||||
set_errno (EROFS);
|
set_errno (EROFS);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
if (isdevfd_dev (devn) || (win32_name.isdevice () && !win32_name.issocket ()))
|
||||||
|
{
|
||||||
|
set_errno (EPERM);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
if (!win32_name.exists ())
|
if (!win32_name.exists ())
|
||||||
{
|
{
|
||||||
debug_printf ("unlinking a nonexistent file");
|
debug_printf ("unlinking a nonexistent file");
|
||||||
|
|
Loading…
Reference in New Issue