]> granicus.if.org Git - vim/commitdiff
patch 8.0.1335: writefile() using fsync() may give an error. v8.0.1335
authorBram Moolenaar <Bram@vim.org>
Sat, 25 Nov 2017 13:37:11 +0000 (14:37 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 25 Nov 2017 13:37:11 +0000 (14:37 +0100)
Problem:    Writefile() using fsync() may give an error for a device.
            (Yasuhiro Matsumoto)
Solution:   Ignore fsync() failing. (closes #2373)

src/evalfunc.c
src/version.c

index 8d288e0dc5a36516ab144ea4d450aa5399c25723..76c576855e7f00729d0a1b001a2905a4ccc273c1 100644 (file)
@@ -13449,8 +13449,10 @@ f_writefile(typval_T *argvars, typval_T *rettv)
        if (write_list(fd, list, binary) == FAIL)
            ret = -1;
 #ifdef HAVE_FSYNC
-       else if (do_fsync && fsync(fileno(fd)) != 0)
-           EMSG(_(e_fsync));
+       else if (do_fsync)
+           /* Ignore the error, the user wouldn't know what to do about it.
+            * May happen for a device. */
+           ignored = fsync(fileno(fd));
 #endif
        fclose(fd);
     }
index 408b85cd429179c78ca8bb52ba5ac9b16da82a16..e0ba19e2894360217882320bb56676667e7e21ef 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1335,
 /**/
     1334,
 /**/