* syscalls.cc (_unlink): Explicitely check for non-existant file.

This commit is contained in:
Corinna Vinschen 2001-07-18 11:00:05 +00:00
parent 78e720e152
commit 5564cd7a89
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Wed 18 Jul 2001 11:56:00 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (_unlink): Explicitely check for non-existant file.
Tue 17 Jul 2001 10:19:00 Corinna Vinschen <corinna@vinschen.de> Tue 17 Jul 2001 10:19:00 Corinna Vinschen <corinna@vinschen.de>
* delqueue.h: Remove obsolete file. * delqueue.h: Remove obsolete file.

View File

@ -83,7 +83,14 @@ _unlink (const char *ourname)
DWORD atts; DWORD atts;
atts = win32_name.file_attributes (); atts = win32_name.file_attributes ();
if (atts != 0xffffffff && atts & FILE_ATTRIBUTE_DIRECTORY) if (atts == 0xffffffff)
{
syscall_printf ("unlinking a nonexistant file");
set_errno (ENOENT);
goto done;
}
if (atts & FILE_ATTRIBUTE_DIRECTORY)
{ {
syscall_printf ("unlinking a directory"); syscall_printf ("unlinking a directory");
set_errno (EPERM); set_errno (EPERM);
@ -98,7 +105,7 @@ _unlink (const char *ourname)
} }
/* Check for shortcut as symlink condition. */ /* Check for shortcut as symlink condition. */
if (atts != 0xffffffff && atts & FILE_ATTRIBUTE_READONLY) if (atts & FILE_ATTRIBUTE_READONLY)
{ {
int len = strlen (win32_name); int len = strlen (win32_name);
if (len > 4 && strcasematch (win32_name + len - 4, ".lnk")) if (len > 4 && strcasematch (win32_name + len - 4, ".lnk"))