mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
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>
This commit is contained in:
parent
8e224507c1
commit
fbc013421c
@ -2919,7 +2919,7 @@ edit_ok_to_exit (WEdit * edit)
|
|||||||
gboolean
|
gboolean
|
||||||
edit_save_block (WEdit * edit, const char *filename, off_t start, off_t finish)
|
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;
|
vfs_path_t *vpath;
|
||||||
|
|
||||||
vpath = vfs_path_from_str (filename);
|
vpath = vfs_path_from_str (filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user