Ticket #2861: additional error handling in edit_save_block().
commitfbc013421c8a9ef1b0a413c611091bb78a15658d
authorYury V. Zaytsev <yury@shurup.com>
Sat, 4 Aug 2012 16:55:07 +0000 (4 18:55 +0200)
committerSlava Zanko <slavazanko@gmail.com>
Mon, 10 Sep 2012 11:29:53 +0000 (10 14:29 +0300)
tree3002fd6e2323236b081e60f7066ef38ad16529d8
parent8e224507c155ac900d39938a8c2d99a76ae0de24
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