mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-15 05:29:10 +08:00
Cygwin: unlink: fix error checking order
Checking EPERM only makes sense if the file exists, so let the EEXIST check change places with the EPERM check. Add a debug statement to the EPERM condition. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
890086ad37
commit
b879cd1661
@ -1136,17 +1136,18 @@ unlink (const char *ourname)
|
|||||||
set_errno (EROFS);
|
set_errno (EROFS);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (!win32_name.isondisk ())
|
|
||||||
{
|
|
||||||
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");
|
||||||
set_errno (ENOENT);
|
set_errno (ENOENT);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
if (!win32_name.isondisk ())
|
||||||
|
{
|
||||||
|
debug_printf ("unlinking a virtual file");
|
||||||
|
set_errno (EPERM);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
else if (win32_name.isdir ())
|
else if (win32_name.isdir ())
|
||||||
{
|
{
|
||||||
debug_printf ("unlinking a directory");
|
debug_printf ("unlinking a directory");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user