Ticket #2861: additional error handling in edit_save_block().
commitaa29f1b718fb30f9bce5005ff60ff6b93b70e91e
authorYury V. Zaytsev <yury@shurup.com>
Sat, 4 Aug 2012 16:55:07 +0000 (4 18:55 +0200)
committerAndrew Borodin <aborodin@vmail.ru>
Thu, 6 Sep 2012 09:25:56 +0000 (6 13:25 +0400)
treec84efcdc762d9b0239d088a2de30dfcc77d1cc43
parent149cd8ea968bc89688f823eee4bc68a19bf52da4
Ticket #2861: additional error handling in edit_save_block().

If edit->column_highlight is on and the disk is so full that the editor
is unable even to write the magic (r <= 0), then subsequent if (len)
check might fail, since the value of len is undefined.

The solution is to initialize len with a non-zero value, so that the
function properly returns an error value in all cases (adding an
explicit return 0; is also possible, but then one must take care of
closing file descriptors, which is less convenient).

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
src/editor/editcmd.c