From aa29f1b718fb30f9bce5005ff60ff6b93b70e91e Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" Date: Sat, 4 Aug 2012 18:55:07 +0200 Subject: [PATCH] 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 --- src/editor/editcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index 09b1cded1..344c8c275 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -2829,7 +2829,7 @@ edit_ok_to_exit (WEdit * edit) gboolean edit_save_block (WEdit * edit, const char *filename, off_t start, off_t finish) { - int len, file; + int len = 1, file; vfs_path_t *vpath; vpath = vfs_path_from_str (filename); -- 2.11.4.GIT