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>
/*
* 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)
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)
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 662,
/**/
661,
/**/