mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 19:18:34 +00:00
Don't use errno constants for os_open() errors
In Windows we can't assume errno will be set by calls to os_* functions, instead the return value from os_* functions can be used. This commit fixes two occurences for os_open(). 1. EFBIG is replaced with UV_EFBIG and checked against the return from os_open(). 2. EOVERFLOW does not have a corresponding libuv constant, and is not defined by open() in Windows - disabled this case with a UNIX guard, and check the return value against -EOVERFLOW (libuv errors are negative errno values in Unix).
This commit is contained in:
@@ -578,11 +578,11 @@ readfile (
|
|||||||
return OK; /* a new file is not an error */
|
return OK; /* a new file is not an error */
|
||||||
} else {
|
} else {
|
||||||
filemess(curbuf, sfname, (char_u *)(
|
filemess(curbuf, sfname, (char_u *)(
|
||||||
# ifdef EFBIG
|
(fd == UV_EFBIG) ? _("[File too big]") :
|
||||||
(errno == EFBIG) ? _("[File too big]") :
|
# if defined(UNIX) && defined(EOVERFLOW)
|
||||||
# endif
|
// libuv only returns -errno in Unix and in Windows open() does not
|
||||||
# ifdef EOVERFLOW
|
// set EOVERFLOW
|
||||||
(errno == EOVERFLOW) ? _("[File too big]") :
|
(fd == -EOVERFLOW) ? _("[File too big]") :
|
||||||
# endif
|
# endif
|
||||||
_("[Permission Denied]")), 0);
|
_("[Permission Denied]")), 0);
|
||||||
curbuf->b_p_ro = TRUE; /* must use "w!" now */
|
curbuf->b_p_ro = TRUE; /* must use "w!" now */
|
||||||
|
Reference in New Issue
Block a user