]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0662: filecopy() may return wrong value when readlink() fails v9.1.0662
authorzeertzjq <zeertzjq@outlook.com>
Tue, 6 Aug 2024 17:51:09 +0000 (19:51 +0200)
committerChristian Brabandt <cb@256bit.org>
Tue, 6 Aug 2024 17:51:09 +0000 (19:51 +0200)
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 <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/fileio.c
src/version.c

index 7bae626a97e4450d0f69a733904dbf63f4783a9a..d27a1727ed1718a573316629ef484787f048632b 100644 (file)
@@ -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)
index 460afa967e97199b29b2930ea2ff7008638c74c0..3a6faeb539a6d9d7302795473633e1da4ba731d6 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    662,
 /**/
     661,
 /**/