patch 9.1.0152: Coverity complains about ignoring return value
Commit:
https://github.com/vim/vim/commit/af7ae8160041e2d17c56945381e9370e7178e596
Author: Christian Brabandt <[email protected]>
Date: Wed Mar 6 19:31:39 2024 +0100
patch 9.1.0152: Coverity complains about ignoring return value
Problem: Coverity complains about ignoring return value of win_split()
(after v9.1.150)
Solution: Check if win_split() failed, add winfixbuf.res to Makefile
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 7233893b1..4b575b4d8 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -469,15 +469,14 @@ ex_listdo(exarg_T *eap)
}
if (win_valid(prevwin) && !prevwin->w_p_wfb)
- {
// 'winfixbuf' is set; attempt to change to a window without it.
win_goto(prevwin);
- }
if (curwin->w_p_wfb)
{
// Split the window, which will be 'nowinfixbuf', and set curwin to
// that
- win_split(0, 0);
+ if (win_split(0, 0) == FAIL)
+ return; // error message already given
if (curwin->w_p_wfb)
{
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index d365dfc84..c4403e67a 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -558,6 +558,7 @@ NEW_TESTS_RES = \
test_window_cmd.res \
test_window_id.res \
test_windows_home.res \
+ test_winfixbuf.res \
test_wordcount.res \
test_writefile.res \
test_xxd.res \
diff --git a/src/testdir/test_winfixbuf.vim b/src/testdir/test_winfixbuf.vim
index 8a1862c3e..edbe2c8f5 100644
--- a/src/testdir/test_winfixbuf.vim
+++ b/src/testdir/test_winfixbuf.vim
@@ -3248,4 +3248,15 @@ func Test_quickfix_changed_split_failed()
augroup! QfChanged
endfunc
+func Test_bufdo_splitwin_fails()
+ call s:reset_all_buffers()
+ let other = s:make_buffer_pairs()
+ " Make sure there is not enough room to
+ " split the winfixedbuf window
+ let &winheight=&lines
+ let &winminheight=&lines-2
+ call assert_fails(':bufdo echo 1', 'E36:')
+ set winminheight&vim winheight&vim
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index ae5d17a1a..cf0af4304 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 */
+/**/
+ 152,
/**/
151,
/**/
--
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1rhxQu-003XwE-JA%40256bit.org.