diff options
author | Christopher Faylor <me@cgf.cx> | 2001-03-10 20:25:19 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-03-10 20:25:19 +0000 |
commit | e2f2a27ee83c8d05ca665acb5a5910e2594c4cc8 (patch) | |
tree | 190502859f2ec5b5964e4719c23fe0acc7dab90a /winsup/cygwin/syscalls.cc | |
parent | 766de5ad55dc0233ac7a558c48d4d8e29761e76f (diff) | |
download | cygnal-e2f2a27ee83c8d05ca665acb5a5910e2594c4cc8.tar.gz cygnal-e2f2a27ee83c8d05ca665acb5a5910e2594c4cc8.tar.bz2 cygnal-e2f2a27ee83c8d05ca665acb5a5910e2594c4cc8.zip |
* syscalls.cc (_rename): Set errno to ENOENT when an old path doesn't exist
(from Kazuhiro Fujieda <fujieda@jaist.ac.jp>). Also set EACCES when directory
is not writable.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 81394f0db..dbb55f321 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1268,8 +1268,8 @@ _rename (const char *oldpath, const char *newpath) if (real_old.error) { - set_errno (real_old.error); syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath); + set_errno (real_old.error); return -1; } @@ -1293,8 +1293,8 @@ _rename (const char *oldpath, const char *newpath) if (real_new.error) { - set_errno (real_new.error); syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath); + set_errno (real_new.error); return -1; } @@ -1302,12 +1302,14 @@ _rename (const char *oldpath, const char *newpath) || !writable_directory (real_new.get_win32 ())) { syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath); + set_errno (EACCES); return -1; } if (real_old.file_attributes () == (DWORD) -1) /* file to move doesn't exist */ { syscall_printf ("file to move doesn't exist"); + set_errno (ENOENT); return (-1); } |