mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
Fix #963.
Problem: Bug was introduced because `os_open` returns `-errno` in case of an error instead of just `-1` which was returned by `mch_open`. Solution: Check return value with `< 0` instead of `== -1`.
This commit is contained in:

committed by
Thiago de Arruda

parent
e057676a89
commit
974408f2de
@@ -4616,7 +4616,7 @@ int vim_rename(char_u *from, char_u *to)
|
|||||||
acl = mch_get_acl(from);
|
acl = mch_get_acl(from);
|
||||||
#endif
|
#endif
|
||||||
fd_in = os_open((char *)from, O_RDONLY, 0);
|
fd_in = os_open((char *)from, O_RDONLY, 0);
|
||||||
if (fd_in == -1) {
|
if (fd_in < 0) {
|
||||||
#ifdef HAVE_ACL
|
#ifdef HAVE_ACL
|
||||||
mch_free_acl(acl);
|
mch_free_acl(acl);
|
||||||
#endif
|
#endif
|
||||||
@@ -4626,7 +4626,7 @@ int vim_rename(char_u *from, char_u *to)
|
|||||||
/* Create the new file with same permissions as the original. */
|
/* Create the new file with same permissions as the original. */
|
||||||
fd_out = os_open((char *)to,
|
fd_out = os_open((char *)to,
|
||||||
O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, (int)perm);
|
O_CREAT|O_EXCL|O_WRONLY|O_NOFOLLOW, (int)perm);
|
||||||
if (fd_out == -1) {
|
if (fd_out < 0) {
|
||||||
close(fd_in);
|
close(fd_in);
|
||||||
#ifdef HAVE_ACL
|
#ifdef HAVE_ACL
|
||||||
mch_free_acl(acl);
|
mch_free_acl(acl);
|
||||||
|
Reference in New Issue
Block a user