From 47d7532e093db8a5068a40c587915121ffaaad18 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 13 Mar 2013 11:42:22 -0700 Subject: File synchronization fixes. * admin/CPP-DEFINES (BSD_SYSTEM, HAVE_FSYNC): Remove. * admin/merge-gnulib (GNULIB_MODULES): Add fsync, fdatasync. * configure.ac (BSD_SYSTEM, BSD_SYSTEM_AHB): Remove; no longer needed. (fsync): Remove check; now done by gnulib. * lib/fdatasync.c, lib/fsync.c, m4/fdatasync.m4, m4/fsync.m4: New files, from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib-src/Makefile.in (LIB_FDATASYNC): New macro. (emacsclient${EXEEXT}): Use it. * lib-src/emacsclient.c (main): Use fdatasync, not fsync, since we don't care about metadata. Keep trying if interrupted. * lib-src/movemail.c (main, popmail): Don't worry about BSD_SYSTEM, since fsync is available everywhere (or there is a substitute). Don't report an error if fsync returns EINVAL. * nt/inc/ms-w32.h (fdatasync): New macro, suggested by Eli Zaretskii. * src/Makefile.in (LIB_FDATASYNC): New macro. (LIBES): Use it. * src/conf_post.h (BSD_SYSTEM, BSD_SYSTEM_AHB): Remove; no longer needed. * src/fileio.c (Fwrite_region, write_region_inhibit_fsync): Don't worry about HAVE_FSYNC, since a substitute fsync is available if the system lacks one. (Fwrite_regin): Retry fsync if interrupted. Fixes: debbugs:13944 --- lib-src/emacsclient.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib-src/emacsclient.c') diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 6feaf18ba60..898e8d69b07 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1724,7 +1724,8 @@ main (int argc, char **argv) needlf = 2; } fflush (stdout); - fsync (1); + while (fdatasync (1) != 0 && errno == EINTR) + continue; /* Now, wait for an answer and print any messages. */ while (exit_status == EXIT_SUCCESS) @@ -1825,7 +1826,8 @@ main (int argc, char **argv) if (needlf) printf ("\n"); fflush (stdout); - fsync (1); + while (fdatasync (1) != 0 && errno == EINTR) + continue; if (rl < 0) exit_status = EXIT_FAILURE; -- cgit v1.2.1