This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
rename() doesn't set the errno properly.
- To: cygwin-patches at cygwin dot com
- Subject: rename() doesn't set the errno properly.
- From: Kazuhiro Fujieda <fujieda at jaist dot ac dot jp>
- Date: 11 Mar 2001 04:35:15 +0900
rename() doesn't set the errno when an old path doesn't exist.
The following patch can solve this problem.
2001-03-11 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* syscalls.cc (_rename): Set errno to ENOENT when an old path
doesn't exist.
Index: syscalls.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/syscalls.cc,v
retrieving revision 1.88
diff -u -p -r1.88 syscalls.cc
--- syscalls.cc 2001/03/07 20:52:33 1.88
+++ syscalls.cc 2001/03/10 19:30:12
@@ -1307,8 +1307,9 @@ _rename (const char *oldpath, const char
if (real_old.file_attributes () == (DWORD) -1) /* file to move doesn't exist */
{
- syscall_printf ("file to move doesn't exist");
- return (-1);
+ set_errno (ENOENT);
+ syscall_printf ("file to move doesn't exist");
+ return (-1);
}
if (real_new.file_attributes () != (DWORD) -1 &&
____
| AIST Kazuhiro Fujieda <fujieda@jaist.ac.jp>
| HOKURIKU School of Information Science
o_/ 1990 Japan Advanced Institute of Science and Technology