patch 9.1.0662: filecopy() may return wrong value when readlink() fails

Commit: 
https://github.com/vim/vim/commit/da090f95df6c015e4f7fc9e1036795a370503a83
Author: zeertzjq <zeert...@outlook.com>
Date:   Tue Aug 6 19:51:09 2024 +0200

    patch 9.1.0662: filecopy() may return wrong value when readlink() fails
    
    Problem:  filecopy() may return wrong value when readlink() fails.
    Solution: Set ret to -1 so that 0 is returned when readlink() fails.
              (zeertzjq)
    
    closes: #15438
    
    Signed-off-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/fileio.c b/src/fileio.c
index 7bae626a9..d27a1727e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3912,7 +3912,7 @@ vim_rename(char_u *from, char_u *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(char_u *from, char_u *to)
@@ -3936,7 +3936,7 @@ vim_copyfile(char_u *from, char_u *to)
     ret = mch_lstat((char *)from, &st);
     if (ret >= 0 && S_ISLNK(st.st_mode))
     {
-       ret = FAIL;
+       ret = -1;
 
        len = readlink((char *)from, linkbuf, MAXPATHL);
        if (len > 0)
diff --git a/src/version.c b/src/version.c
index 460afa967..3a6faeb53 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    662,
 /**/
     661,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sbOTj-001hPm-8I%40256bit.org.

Raspunde prin e-mail lui