diff options
author | Bram Moolenaar <Bram@vim.org> | 2008-11-29 19:19:19 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2008-11-29 19:19:19 +0000 |
commit | 2eb6eb323fc26e944eef8cf47ed47fce21452217 (patch) | |
tree | e56ec8d0d77f61ba099f41ce704baf2f9be7d665 /src/spell.c | |
parent | 9bf13616521b10db3545031f7a07d140dbc7b137 (diff) | |
download | vim-git-2eb6eb323fc26e944eef8cf47ed47fce21452217.tar.gz |
updated for version 7.2-057v7.2.057
Diffstat (limited to 'src/spell.c')
-rw-r--r-- | src/spell.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/spell.c b/src/spell.c index 058f7d68c..8c9a89184 100644 --- a/src/spell.c +++ b/src/spell.c @@ -7926,7 +7926,7 @@ write_vim_spell(spin, fname) char_u *p; int rr; int retval = OK; - int fwv = 1; /* collect return value of fwrite() to avoid + size_t fwv = 1; /* collect return value of fwrite() to avoid warnings from picky compiler */ fd = mch_fopen((char *)fname, "w"); @@ -7939,6 +7939,10 @@ write_vim_spell(spin, fname) /* <HEADER>: <fileID> <versionnr> */ /* <fileID> */ fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd); + if (fwv != (size_t)1) + /* Catch first write error, don't try writing more. */ + goto theend; + putc(VIMSPELLVERSION, fd); /* <versionnr> */ /* @@ -8300,11 +8304,11 @@ write_vim_spell(spin, fname) /* Write another byte to check for errors (file system full). */ if (putc(0, fd) == EOF) retval = FAIL; - +theend: if (fclose(fd) == EOF) retval = FAIL; - if (fwv != 1) + if (fwv != (size_t)1) retval = FAIL; if (retval == FAIL) EMSG(_(e_write)); @@ -9897,7 +9901,7 @@ write_spell_prefcond(fd, gap) char_u *p; int len; int totlen; - int x = 1; /* collect return value of fwrite() */ + size_t x = 1; /* collect return value of fwrite() */ if (fd != NULL) put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */ |