aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Neisen <nwneisen@gmail.com>2018-05-16 19:18:35 -0600
committerJustin M. Keyes <justinkz@gmail.com>2018-05-17 09:01:05 +0200
commitaea70b4404399d353e1df0bd73ef344f5559843a (patch)
tree2faa8cd28bfcd454ec3b85e286b339ab987801de /src
parent32df42549a49124976e1993218cd560833777482 (diff)
downloadrneovim-aea70b4404399d353e1df0bd73ef344f5559843a.tar.gz
rneovim-aea70b4404399d353e1df0bd73ef344f5559843a.tar.bz2
rneovim-aea70b4404399d353e1df0bd73ef344f5559843a.zip
coverity/13709: spell_add_word: handle failed fseek()
Check the return status after removing a duplicate word. Add a log for a nonzero return status.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/spellfile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index dab9a2aacd..b844fd9ab8 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -5368,8 +5368,9 @@ spell_add_word (
// doesn't work for all systems, close the file first.
fclose(fd);
fd = mch_fopen((char *)fname, "r+");
- if (fd == NULL)
+ if (fd == NULL) {
break;
+ }
if (fseek(fd, fpos, SEEK_SET) == 0) {
fputc('#', fd);
if (undo) {
@@ -5378,7 +5379,9 @@ spell_add_word (
len, word, NameBuff);
}
}
- fseek(fd, fpos_next, SEEK_SET);
+ if (fseek(fd, fpos_next, SEEK_SET) <= 0) {
+ break;
+ }
}
}
if (fd != NULL)