summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog33
-rw-r--r--lib-src/Makefile.in4
-rw-r--r--lib-src/emacsclient.c6
-rw-r--r--lib-src/etags.c5
-rw-r--r--lib-src/movemail.c27
-rw-r--r--lib-src/pop.c2
6 files changed, 48 insertions, 29 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 81876d86165..0d7a0a4591e 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,34 @@
+2013-03-16 Paul Eggert <eggert@cs.ucla.edu>
+
+ * pop.c: Fix ERRMAX typo (Bug#13925).
+ (socket_connection) [!HAVE_KRB5_ERROR_TEXT && HAVE_KRB5_ERROR_E_TEXT]:
+ Use ERROR_MAX, not ERRMAX.
+
+2013-03-16 Glenn Morris <rgm@gnu.org>
+
+ * Version 24.3 released.
+
+2013-03-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ File synchronization fixes (Bug#13944).
+ * Makefile.in (LIB_FDATASYNC): New macro.
+ (emacsclient${EXEEXT}): Use it.
+ * emacsclient.c (main): Use fdatasync, not fsync, since we don't
+ care about metadata. Keep trying if interrupted.
+ * 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.
+
+ Static checking by Sun C 5.12.
+ * etags.c (analyse_regex): Omit unreachable code.
+
+ * movemail.c (main): Call umask on all systems.
+ This is OK since Emacs already assumes umask elsewhere.
+ Don't grant more read permissions than necessary.
+ The old 0333 dates back to before we called setuid,
+ so it was needed back then to ensure user-readability,
+ but 0377 should suffice now.
+
2013-02-08 Paul Eggert <eggert@cs.ucla.edu>
* movemail.c (getenv): Remove decl (unused since 1994).
@@ -5161,7 +5192,7 @@
(longopts): New long options without short counterpart are
globals, members, no-globals, no-members. Regexp options are now
defined conditionally to ETAGS_REGEXPS.
- (print_help): Updated.
+ (print_help): Update.
1997-05-22 Francesco Potortì <F.Potorti@cnuce.cnr.it>
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index 8a6960ee2fe..7069af9767a 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -161,6 +161,8 @@ LIBRESOLV=@LIBRESOLV@
LIBS_MAIL=@LIBS_MAIL@
## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
+## empty or -lrt or -lposix4 if HAVE_FDATASYNC
+LIB_FDATASYNC = @LIB_FDATASYNC@
## Extra libraries to use when linking movemail.
LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
@@ -334,7 +336,7 @@ pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h)
emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(config_h)
$(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
-DVERSION="\"${version}\"" \
- $(LOADLIBES) -o emacsclient
+ $(LOADLIBES) $(LIB_FDATASYNC) -o emacsclient
hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h)
$(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
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;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index c1e12e95da4..27a853a954a 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -5628,10 +5628,7 @@ analyse_regex (char *regex_arg)
/* regexfile is a file containing regexps, one per line. */
regexfp = fopen (regexfile, "r");
if (regexfp == NULL)
- {
- pfatal (regexfile);
- return;
- }
+ pfatal (regexfile);
linebuffer_init (&regexbuf);
while (readline_internal (&regexbuf, regexfp) > 0)
analyse_regex (regexbuf.buffer);
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index cf93fb78d98..81ac8aa187c 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -380,13 +380,9 @@ main (int argc, char **argv)
if (indesc < 0)
pfatal_with_name (inname);
-#ifdef BSD_SYSTEM
- /* In case movemail is setuid to root, make sure the user can
- read the output file. */
- /* This is desirable for all systems
- but I don't want to assume all have the umask system call */
- umask (umask (0) & 0333);
-#endif /* BSD_SYSTEM */
+ /* Make sure the user can read the output file. */
+ umask (umask (0) & 0377);
+
outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (outdesc < 0)
pfatal_with_name (outname);
@@ -470,10 +466,8 @@ main (int argc, char **argv)
}
}
-#ifdef BSD_SYSTEM
- if (fsync (outdesc) < 0)
+ if (fsync (outdesc) != 0 && errno != EINVAL)
pfatal_and_delete (outname);
-#endif
/* Prevent symlink attacks truncating other users' mailboxes */
if (setregid (-1, real_gid) < 0)
@@ -754,21 +748,14 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse
}
}
- /* On AFS, a call to write only modifies the file in the local
- * workstation's AFS cache. The changes are not written to the server
- * until a call to fsync or close is made. Users with AFS home
- * directories have lost mail when over quota because these checks were
- * not made in previous versions of movemail. */
-
-#ifdef BSD_SYSTEM
- if (fsync (mbfi) < 0)
+ if (fsync (mbfi) != 0 && errno != EINVAL)
{
error ("Error in fsync: %s", strerror (errno), 0);
+ close (mbfi);
return EXIT_FAILURE;
}
-#endif
- if (close (mbfi) == -1)
+ if (close (mbfi) != 0)
{
error ("Error in close: %s", strerror (errno), 0);
return EXIT_FAILURE;
diff --git a/lib-src/pop.c b/lib-src/pop.c
index ba384db3d19..1f3f82baa68 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1198,7 +1198,7 @@ socket_connection (char *host, int flags)
}
#elif defined HAVE_KRB5_ERROR_E_TEXT
if (err_ret && err_ret->e_text && **err_ret->e_text)
- snprintf (pop_error + pop_error_len, ERRMAX - pop_error_len,
+ snprintf (pop_error + pop_error_len, ERROR_MAX - pop_error_len,
" [server says '%s']", *err_ret->e_text);
#endif
if (err_ret)