From 3112d7a41c20a4f12ba57ad266a984bbb04331dc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 19 Dec 2000 20:43:41 +0000 Subject: [PATCH] * syscalls.cc (remove): New function, overriding the newlib implementation. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/syscalls.cc | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d0dfabf4c..8e0a9037c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Tue Dec 19 21:39:00 2000 Corinna Vinschen + + * syscalls.cc (remove): New function, overriding the newlib + implementation. + Tue Dec 19 16:26:00 2000 Corinna Vinschen * environ.cc (struct parse_thing): Add entry for new CYGWIN option diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 103181abf..1cf7d6284 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -166,6 +166,25 @@ done: return res; } +extern "C" int +remove (const char *ourname) +{ + path_conv win32_name (ourname, PC_SYM_NOFOLLOW | PC_FULL); + + if (win32_name.error) + { + set_errno (win32_name.error); + syscall_printf ("-1 = remove (%s)", ourname); + return -1; + } + + DWORD atts = win32_name.file_attributes (); + if (atts != 0xffffffff && atts & FILE_ATTRIBUTE_DIRECTORY) + return rmdir (ourname); + + return _unlink (ourname); +} + extern "C" pid_t _getpid () { -- 2.43.5