diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-08-07 06:14:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-07 06:14:05 +0800 |
commit | 4ddc4a11ca87141253f3cb422f3e843ae3282aa2 (patch) | |
tree | a7f535f037905e3ea34388eb695a7224fb6d3f3c | |
parent | 0a1212ef94547f04db789a660639fab6837e00ce (diff) | |
download | rneovim-4ddc4a11ca87141253f3cb422f3e843ae3282aa2.tar.gz rneovim-4ddc4a11ca87141253f3cb422f3e843ae3282aa2.tar.bz2 rneovim-4ddc4a11ca87141253f3cb422f3e843ae3282aa2.zip |
vim-patch:9.1.0662: filecopy() may return wrong value when readlink() fails (#29998)
Problem: filecopy() may return wrong value when readlink() fails.
Solution: Set ret to -1 so that 0 is returned when readlink() fails.
(zeertzjq)
closes: vim/vim#15438
https://github.com/vim/vim/commit/da090f95df6c015e4f7fc9e1036795a370503a83
-rw-r--r-- | src/nvim/fileio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index cfce9c2954..e4bdef4c7d 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -2710,7 +2710,7 @@ int vim_rename(const char *from, const char *to) } /// Create the new file with same permissions as the original. -/// Return -1 for failure, 0 for success. +/// Return FAIL for failure, OK for success. int vim_copyfile(const char *from, const char *to) { char *errmsg = NULL; @@ -2718,7 +2718,7 @@ int vim_copyfile(const char *from, const char *to) #ifdef HAVE_READLINK FileInfo from_info; if (os_fileinfo_link(from, &from_info) && S_ISLNK(from_info.stat.st_mode)) { - int ret = FAIL; + int ret = -1; char linkbuf[MAXPATHL + 1]; ssize_t len = readlink(from, linkbuf, MAXPATHL); |