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  <[EMAIL PROTECTED]>

        * 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 <[EMAIL PROTECTED]>
  | HOKURIKU  School of Information Science
o_/ 1990      Japan Advanced Institute of Science and Technology

Reply via email to