diff options
author | Bram Moolenaar <Bram@vim.org> | 2008-11-28 20:29:07 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2008-11-28 20:29:07 +0000 |
commit | fe86f2d7cdb284f18543cac2e6cbbe11352c7f48 (patch) | |
tree | 9b8155ee2c3fe3142e4258590d210451db55db1f /src/diff.c | |
parent | a40b46614a54de01a74d37a771db4dbfa44afee9 (diff) | |
download | vim-git-fe86f2d7cdb284f18543cac2e6cbbe11352c7f48.tar.gz |
updated for version 7.2-055v7.2.055
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/diff.c b/src/diff.c index 8bf0ed81b..106bbd116 100644 --- a/src/diff.c +++ b/src/diff.c @@ -661,6 +661,7 @@ ex_diffupdate(eap) char_u *tmp_diff; FILE *fd; int ok; + int io_error = FALSE; /* Delete all diffblocks. */ diff_clear(curtab); @@ -697,18 +698,26 @@ ex_diffupdate(eap) { ok = FALSE; fd = mch_fopen((char *)tmp_orig, "w"); - if (fd != NULL) + if (fd == NULL) + io_error = TRUE; + else { - fwrite("line1\n", (size_t)6, (size_t)1, fd); + if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1) + io_error = TRUE; fclose(fd); fd = mch_fopen((char *)tmp_new, "w"); - if (fd != NULL) + if (fd == NULL) + io_error = TRUE; + else { - fwrite("line2\n", (size_t)6, (size_t)1, fd); + if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1) + io_error = TRUE; fclose(fd); diff_file(tmp_orig, tmp_new, tmp_diff); fd = mch_fopen((char *)tmp_diff, "r"); - if (fd != NULL) + if (fd == NULL) + io_error = TRUE; + else { char_u linebuf[LBUFLEN]; @@ -761,6 +770,8 @@ ex_diffupdate(eap) } if (!ok) { + if (io_error) + EMSG(_("E810: Cannot read or write temp files")); EMSG(_("E97: Cannot create diffs")); diff_a_works = MAYBE; #if defined(MSWIN) || defined(MSDOS) @@ -925,10 +936,10 @@ ex_diffpatch(eap) { # ifdef TEMPDIRNAMES if (vim_tempdir != NULL) - mch_chdir((char *)vim_tempdir); + ignored = mch_chdir((char *)vim_tempdir); else # endif - mch_chdir("/tmp"); + ignored = mch_chdir("/tmp"); shorten_fnames(TRUE); } #endif |