aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/movemail.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year to 2014 by running admin/update-copyright.Paul Eggert2014-01-011-1/+1
|
* Fix some minor races in hosts lacking mkostemp.Paul Eggert2013-08-041-14/+3
| | | | | | | | | | | | | | | | | | | | | | Gnulib's emulation of mkostemp doesn't have races that Emacs's does. * configure.ac (mkostemp): Remove check for this function; gnulib does the check now. (mkstemp): Remove check for this no-longer-used function. * lib/mkostemp.c, lib/secure_getenv.c, lib/tempname.c, lib/tempname.h: * m4/mkostemp.m4, m4/secure_getenv.m4, m4/tempname.m4: New files, copied from Gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * admin/merge-gnulib (GNULIB_MODULES): Add mkostemp. * lib-src/movemail.c (main): * lib-src/update-game-score.c (write_scores): Use mkostemp (which now works on all platforms, due to changes in the portability layer) rather than mktemp (which has a race) or mkstemp (which we no longer bother with). * src/callproc.c (create_temp_file): * src/filelock.c (create_lock_file): Assume mkostemp, since it's now provided by Gnulib. Fixes: debbugs:15015
* File synchronization fixes.Paul Eggert2013-03-131-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* * movemail.c: Don't grant more read permissions than necessary.Paul Eggert2013-03-121-3/+3
| | | | | | 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.
* * movemail.c (main): Call umask on all systems.Paul Eggert2013-03-121-4/+0
| | | | This is OK since Emacs already assumes umask elsewhere.
* * movemail.c (getenv): Remove decl (unused since 1994).Paul Eggert2013-02-081-1/+0
|
* Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.caPaul Eggert2013-01-021-2/+2
|\
| * Update copyright notices for 2013.Paul Eggert2013-01-011-2/+2
| |
* | Assume POSIX 1003.1-1988 or later for errno.h.Paul Eggert2012-11-261-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib-src/movemail.c (main): Assume EAGAIN and EBUSY. * src/dired.c (directory_files_internal, file_name_completion): Assume EAGAIN and EINTR are defined. * src/fileio.c (Fcopy_file): Assume EISDIR is defined. * src/gmalloc.c (ENOMEM, EINVAL): Assume they're defined. * src/gnutls.c (emacs_gnutls_write): Assume EAGAIN is defined. * src/lread.c (readbyte_from_file): Assume EINTR is defined. * src/process.c (wait_reading_process_output, send_process) [subprocesses]: Assume EIO and EAGAIN are defined. * src/unexcoff.c (write_segment): Assume EFAULT is defined. Fixes: debbugs:12968
* | movemail: treat EACCES etc. failures as permanentPaul Eggert2012-11-231-5/+2
| | | | | | | | | | * movemail.c (main): Treat any link failure other than EEXIST as a permanent failure, not just EPERM. EACCES, for example.
* | Assume POSIX 1003.1-1988 or later for unistd.h.Paul Eggert2012-11-211-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * admin/CPP-DEFINES (BROKEN_GETWD, HAVE_GETCWD, HAVE_GETWD, HAVE_SIZE_T) (HAVE_UNISTD_H): Remove. * configure.ac: Do not check for getcwd or getwd. * lib-src/emacsclient.c (getcwd): Remove decl. (get_current_dir_name): Assume getcwd exists. * lib-src/etags.c (HAVE_GETCWD): Remove. (getcwd): Remove decl. (NO_LONG_OPTIONS): Remove this. All uses removed. Emacs always has GNU getopt. (etags_getcwd): Assume getcwd exists. * lib-src/movemail.c (F_OK, X_OK, W_OK, R_OK): Remove. * nt/config.nt (HAVE_GETCWD): Remove. * src/alloc.c: Assume unistd.h exists. * src/fileio.c (Fexpand_file_name) [DOS_NT]: Use getcwd, not getwd. * src/sysdep.c (get_current_dir_name): Assume getcwd exists. (getwd) [USG]: Remove; no longer needed. (sys_subshell) [DOS_NT]: Use getcwd, not getwd. * src/w32.c (getcwd): Rename from getwd, and switch to getcwd's API. * src/w32.h (getcwd): Remove decl. Fixes: debbugs:12945
* | Assume POSIX 1003.1-1988 or later for fcntl.h.Paul Eggert2012-11-171-2/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * admin/CPP-DEFINES (O_RDONLY, O_RDWR, HAVE_FCNTL_H): Remove. * admin/merge-gnulib (GNULIB_MODULES): Add fcntl-h. * configure.ac: Do not check for fcntl.h. * lib/gnulib.mk: Regenerate. * lib-src/movemail.c, lib-src/update-game-score.c: Assume <fcntl.h> exists. * nt/inc/sys/socket.h (O_NONBLOCK): Rename from O_NDELAY, since the POSIX name for this flag is O_NONBLOCK. All uses changed. * nt/inc/unistd.h (O_RDWR, O_NOCTTY): New macros. Like AT_FDCWD etc. these really should be moved to a replacement <fcntl.h> if and when that gets implemented. In the meantime, include <fcntl.h> to make sure we don't override its definitions. * src/callproc.c (relocate_fd): Assume F_DUPFD. * src/emacs.c, src/term.c (O_RDWR): Remove. * src/keyboard.c (tty_read_avail_input): Use O_NONBLOCK rather than O_NDELAY, since O_NONBLOCK is the standard name for this flag. * src/nsterm.m: Assume <fcntl.h> exists. * src/process.c (NON_BLOCKING_CONNECT, allocate_pty, create_process) (create_pty, Fmake_network_process, server_accept_connection) (wait_reading_process_output, init_process_emacs): Assume O_NONBLOCK. (wait_reading_process_output): Put in a special case for WINDOWSNT to mimick the older behavior where it had O_NDELAY but not O_NONBLOCK. It's not clear this is needed, but it's a more-conservative change. (create_process): Assume FD_CLOEXEC. (create_process, create_pty): Assume O_NOCTTY. * src/sysdep.c (init_sys_modes, reset_sys_modes): Assume F_SETFL. (reset_sys_modes): Use O_NONBLOCK rather than O_NDELAY. Omit if not DOS_NT, since F_GETFL is not defined there. (serial_open): Assume O_NONBLOCK and O_NOCTTY. * src/term.c: Include <fcntl.h>, for flags like O_NOCTTY. (O_NOCTTY): Remove. (init_tty): Assume O_IGNORE_CTTY is defined to 0 on platforms that lack it, since gnulib guarantees this. * src/w32.c (fcntl): Test for O_NONBLOCK rather than O_NDELAY. Fixes: debbugs:12881
* CommentsGlenn Morris2012-08-101-8/+7
|
* Move DIRECTORY_SEP from lisp.h to config.hGlenn Morris2012-08-091-7/+0
| | | | | | | | | | | | | * configure.ac (DIRECTORY_SEP): Move here from src/lisp.h. * src/lisp.h (DIRECTORY_SEP): Let configure set it. * nt/config.nt (DIRECTORY_SEP): Move here from src/lisp.h. * lib-src/movemail.c (DIRECTORY_SEP, IS_DIRECTORY_SEP): * lib-src/make-docfile.c (DIRECTORY_SEP, IS_DIRECTORY_SEP): * lib-src/emacsclient.c (DIRECTORY_SEP, IS_DIRECTORY_SEP, IS_DEVICE_SEP): Remove (they are in config.h now).
* Refill commentGlenn Morris2012-08-081-6/+5
|
* CommentsGlenn Morris2012-08-081-4/+4
|
* Port to Solaris 8.Paul Eggert2012-08-011-2/+2
| | | | | | | | | | Without this change, 'configure' fails because the recently-added wait3 prototype in config.h messes up later 'configure' tests. Fix this problem by droping wait3 and WRETCODE, as they're no longer needed on hosts that are current porting targets. * configure.ac (wait3, WRETCODE): Remove, fixing a FIXME. All uses changed to waitpid and WEXITSTATUS. * src/syswait.h (WRETCODE): Remove, consistently with ../configure.ac.
* * movemail.c: Add missing 'defined'.Paul Eggert2012-07-121-1/+1
| | | | | Suggested by Sven Joachim in <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00218.html>.
* Port 'movemail' again to Solaris and similar hosts.Paul Eggert2012-07-111-19/+21
| | | | | | | | | | See Susan Cragin's report in <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00199.html>. * movemail.c (xmalloc): Also define if !DISABLE_DIRECT_ACCESS && !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK. Move up, so it doesn't need a forward declaration. (main): Rewrite to avoid no-longer-present function 'concat', if !DISABLE_DIRECT_ACCESS && !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK.
* Assume strerror.Paul Eggert2012-07-101-22/+0
|
* Simplify by avoiding confusing use of strncpy etc.Paul Eggert2012-07-101-32/+13
|
* Switch from NO_RETURN to C11's _Noreturn.Paul Eggert2012-06-241-3/+3
| | | | Fixes: debbugs:11750
* Add 2012 to FSF copyright years for Emacs filesGlenn Morris2012-01-051-1/+1
|
* Whitespace changes.Juanma Barranquero2011-09-091-2/+2
|
* * movemail.c (main): Do not use sprintf when its result might not fitPaul Eggert2011-08-281-4/+3
| | | | | in 'int'. Instead, put the possibly-long file name into the output of pfatal_with_name.
* Assume freestanding C89 headers, string.h, stdlib.h.Paul Eggert2011-07-061-2/+0
|
* * movemail.c: Fix race condition and related bugs (Bug#8836).Paul Eggert2011-06-101-11/+24
| | | | | | | | | (main) [!MAIL_USE_SYSTEM_LOCK]: Prefer mkstemp to mktemp, as this fixes some race conditions. Report mkstemp/mktemp errno rather than a possibly-garbage errno. Reinitialize the template each time through the loop, as earlier mkstemp/mktemp calls could have trashed it. Pass 0600 (not 0666) to mktemp, for consistency with mkstemp; the permissions don't matter anyway.
* * movemail.c (mail_spool_name): Protoize.Paul Eggert2011-04-161-6/+14
| | | | | (main): Remove unused var. Mark var as initialized. Move locals to avoid shadowing, and use time_t for times.
* * movemail.c: Define macros only in needed contexts.Paul Eggert2011-02-211-0/+13
|
* * movemail.c (popmail): Report fchown failure instead of ignoring it.Paul Eggert2011-02-211-1/+12
| | | | But if the file already has the right ownership, don't worry about it.
* * movemail.c: (DIRECTORY_SEP, IS_DIRECTORY_SEP, DONE, IS_FROM_LINE):Paul Eggert2011-02-211-15/+0
| | | | | | Remove unused macros. * pop.c (index): Remove unused macro. (KPOP_PORT): Define only if KERBEROS is defined.
* * movemail.c: Remove unused varsPaul Eggert2011-02-211-5/+0
|
* * movemail.c (main, pop_retr): Rename locals to avoid shadowing.Paul Eggert2011-02-211-11/+11
|
* Declare file-scope functions and variables static if not exported.Paul Eggert2011-02-211-7/+7
| | | | | | | | This is more consistent, and is nicer with gcc -Wstrict-prototypes. * ebrowse.c, emacsclient.c, fakemail.c, make-docfile.c, movemail.c: * profile.c, test-distrib.c, update-game-score.c: Declare non-'main' functions and variables to be static. * ebrowse.c: Omit redundant function prototypes.
* Refill some long/short copyright headers.Glenn Morris2011-01-261-1/+3
|
* Convert consecutive FSF copyright years to ranges.Glenn Morris2011-01-241-2/+1
|
* Merge from emacs-23.Glenn Morris2011-01-241-4/+4
|\ | | | | | | Note setting of CANNOT_DUMP on ia64 hpux is still to be merged manually.
| * * movemail.c (main): Use setregid, as setegid is missing on HP-UX (Bug#6811).Chong Yidong2011-01-231-4/+4
| | | | | | | | Suggested by Peter O'Gorman.
* | Check return values of some library calls.Paul Eggert2011-01-221-1/+2
| |
* | Merge from mainline.Paul Eggert2011-01-171-2/+0
|\ \
| * | Nuke arch-tags.Glenn Morris2011-01-151-2/+0
| | |
* | | Merge from mainline.Paul Eggert2011-01-141-1/+1
|\ \ \ | |/ /
| * | Merge from emacs-23Stefan Monnier2011-01-141-1/+1
| |\ \ | | |/
| | * Add 2011 to FSF/AIST copyright years.Glenn Morris2011-01-021-1/+1
| | |
| | * Fix permissions handling (CVE-2010-0825).Chong Yidong2010-04-021-26/+19
| | | | | | | | | | | | | | | | | | * movemail.c (main): Check return values of setuid. Avoid possibility of symlink attack when movemail is setgid mail (CVE-2010-0825).
* | | Include <unistd.h> unilaterally.Paul Eggert2011-01-091-2/+0
|/ /
* | Fix compilation warnings.Dan Nicolaescu2010-10-031-4/+3
| | | | | | | | | | | | | | | | | | | | * lib-src/test-distrib.c (cool_read): * lib-src/movemail.c (main, concat): * lib-src/make-docfile.c (scan_file, write_c_args): * emacsclient.c (get_server_config): Fix -Wconversion warning. (egetenv): Move conditional definition earlier. (progname): Use const. * lib-src/sorted-doc.c (xstrdup): Use const.
* | Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).Jan D2010-08-111-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * b2m.c (concat, fatal): Use const char*. (main): Don't assign labels a string literal. * ebrowse.c (struct member): filename, def_filename is const. (struct sym): filename, sfilename is const. (struct kw): name is const. (add_sym, yyerror, token_string, insert_keyword, main): Use const char*. * emacsclient.c (message, sock_err_message, send_to_emacs) (quote_argument, set_local_socket) (start_daemon_and_retry_set_socket): Use const char*. * etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes) (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes) (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes) (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help) (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help) (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help) (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help) (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters) (Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes) (PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help) (Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes) (Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help) (no_lang_help, print_language_names) (get_language_from_interpreter, get_language_from_filename) (init, make_tag, struct C_stab_entry, write_classname, TEX_defenv) (TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal) (concat): Use const char*. * make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use const char *. * movemail.c (fatal, error, concat): Use const char *. * pop.c (pop_multi_first, socket_connection, sendline): Use conat char*. * pop.h (pop_multi_first): Use const char *. (_ARGS): Remove. * sorted-doc.c (error, fatal, states): Use const char *. * update-game-score.c (get_prefix, write_scores, main): Use const char*.
* | Add NO_RETURN specifiers to functions in lib-src.Dan Nicolaescu2010-07-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | * lib-src/update-game-score.c (usage): Add NO_RETURN specifier. * lib-src/movemail.c (fatal, pfatal_with_name, pfatal_and_delete): * lib-src/make-docfile.c (fatal): * lib-src/hexl.c (usage): * lib-src/fakemail.c (fatal): * lib-src/etags.c (fatal, suggest_asking_for_help, pfatal): * lib-src/emacsclient.c (fatal): * lib-src/b2m.c (fatal): Likewise.
* | Use strchr, strrchr instead of index, rindexAndreas Schwab2010-07-111-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * callint.c (Fcall_interactively): Use strchr, strrchr instead of index, rindex. * doc.c (get_doc_string, Fsnarf_documentation): Likewise. * editfns.c (Fuser_full_name, Fformat): Likewise. * emacs.c (argmatch, sort_args, decode_env_path): Likewise. * fileio.c (Ffile_symlink_p): Likewise. * filelock.c (current_lock_owner): Likewise. * font.c (font_parse_name, font_parse_family_registry): Likewise. * fontset.c (fontset_pattern_regexp): Likewise. * lread.c (read1): Likewise. * sysdep.c (init_system_name): Likewise. * xfns.c (select_visual): Likewise. * s/hpux10-20.h (index, rindex): Don't define. * s/ms-w32.h (index): Likewise. * s/usg5-4.h: Likewise. * sed2v2.inp (HAVE_INDEX, HAVE_RINDEX): Don't edit. (HAVE_STRCHR, HAVE_STRRCHR): Edit to 1. * emacsclient.c (set_local_socket): Use strchr, strrchr instead of index, rindex. * movemail.c (mail_spool_name, popmail): Likewise. * pop.c (pop_list): Likewise. * CPP-DEFINES (HAVE_INDEX, HAVE_RINDEX): Remove. * configure.in: Don't check for index and rindex, check for strchr and strrchr. Define strchr and strrchr as index and rindex, resp., in src/config.h if not available.