From 4910ac9ab8984551391df78dbf2744e6b4f5ef67 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 5 May 2021 22:58:28 -0400 Subject: [PATCH] vim-patch:8.2.2828: Coverity complains about not checking rename() return value Problem: Coverity complains about not checking the rename() return value. Solution: Add "(void)", can't do anything in case of a failure. https://github.com/vim/vim/commit/97a6c6a1fb6043fd6520fbaaafc6970334186167 --- src/nvim/fileio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 792ef81665..29c29a2884 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -4560,11 +4560,12 @@ int vim_rename(const char_u *from, const char_u *to) if (!os_path_exists(tempname)) { if (os_rename(from, tempname) == OK) { - if (os_rename(tempname, to) == OK) + if (os_rename(tempname, to) == OK) { return 0; - /* Strange, the second step failed. Try moving the - * file back and return failure. */ - os_rename(tempname, from); + } + // Strange, the second step failed. Try moving the + // file back and return failure. + (void)os_rename(tempname, from); return -1; } /* If it fails for one temp name it will most likely fail