From 5b365d691700e8e59f96dfa3a4c209574da29898 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sat, 18 Nov 2006 18:45:50 +0100 Subject: [PATCH] we always want to DOTLOCK mboxes. Signed-off-by: Pierre Habouzit --- configure.ac | 6 +----- init.h | 11 ----------- main.c | 5 ----- mx.c | 23 ++--------------------- 4 files changed, 3 insertions(+), 42 deletions(-) diff --git a/configure.ac b/configure.ac index 2b944ef..ce8e3ae 100644 --- a/configure.ac +++ b/configure.ac @@ -250,7 +250,6 @@ if test x$with_homespool != x; then relative the the home directory. use: configure --with-homespool=FILE ]) - AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ]) mutt_cv_setgid=no else AC_ARG_WITH(mailpath, AC_HELP_STRING([--with-mailpath=DIR], [Directory where spool mailboxes are located]), @@ -285,9 +284,7 @@ int main (int argc, char **argv) }], mutt_cv_worldwrite=yes, mutt_cv_worldwrite=no, mutt_cv_worldwrite=no)]) mutt_cv_setgid=no - if test $mutt_cv_worldwrite = yes; then - AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ]) - else + if test $mutt_cv_worldwrite != yes; then AC_CACHE_CHECK(if $mutt_cv_mailpath is group writable, mutt_cv_groupwrite, [AC_TRY_RUN([#include #include @@ -301,7 +298,6 @@ int main (int argc, char **argv) }], mutt_cv_groupwrite=yes, mutt_cv_groupwrite=no, mutt_cv_groupwrite=no)]) if test $mutt_cv_groupwrite = yes; then - AC_DEFINE(USE_DOTLOCK,1,[ Define to use dotlocking for mailboxes. ]) AC_DEFINE(USE_SETGID,1,[ Define if mutt should run setgid "mail". ]) mutt_cv_setgid=yes fi diff --git a/init.h b/init.h index 798c478..273b9df 100644 --- a/init.h +++ b/init.h @@ -95,9 +95,6 @@ struct option_t { # ifndef USE_GNUTLS # define USE_GNUTLS # endif -# ifndef USE_DOTLOCK -# define USE_DOTLOCK -# endif # ifndef USE_HCACHE # define USE_HCACHE # endif @@ -566,17 +563,12 @@ struct option_t MuttVars[] = { ** is viewed it is passed as standard input to $$display_filter, and the ** filtered message is read from the standard output. */ -#if defined(USE_DOTLOCK) {"dotlock_program", DT_PATH, R_NONE, UL &MuttDotlock, "$madmutt_bindir/muttng_dotlock"}, /* - ** .pp - ** Availability: Dotlock - ** ** .pp ** Contains the path of the \fTmadmutt_dotlock(1)\fP binary to be used by ** Madmutt. */ -#endif {"dsn_notify", DT_STR, R_NONE, UL &DsnNotify, ""}, /* ** .pp @@ -3751,9 +3743,6 @@ static const char* Features[] = { #ifdef HAVE_LIBIDN "idn", #endif -#ifdef USE_DOTLOCK - "dotlock", -#endif #ifdef USE_NNTP "nntp", #endif diff --git a/main.c b/main.c index 9a4a3df..1e512c5 100644 --- a/main.c +++ b/main.c @@ -218,11 +218,6 @@ static void show_version (void) #else "-USE_SETGID " #endif -#ifdef USE_DOTLOCK - "+USE_DOTLOCK " -#else - "-USE_DOTLOCK " -#endif #ifdef USE_FCNTL "+USE_FCNTL " #else diff --git a/mx.c b/mx.c index d1534ea..88537ab 100644 --- a/mx.c +++ b/mx.c @@ -26,6 +26,7 @@ #include "copy.h" #include "keymap.h" #include "compress.h" +#include "dotlock.h" #include #include @@ -38,10 +39,6 @@ #include "nntp/mx_nntp.h" #endif -#ifdef USE_DOTLOCK -#include "dotlock.h" -#endif - #include static mx_t const *mxfmts[] = { @@ -60,12 +57,10 @@ static mx_t const *mxfmts[] = { #define MX_IDX(idx) (idx >= 0 && idx < countof(mxfmts)) #define mutt_is_spool(s) (m_strcmp(Spoolfile, s) == 0) -#ifdef USE_DOTLOCK /* parameters: * path - file to lock * retry - should retry if unable to lock? */ - static int invoke_dotlock (const char *path, int flags, int retry) { char cmd[LONG_STRING + _POSIX_PATH_MAX]; @@ -125,8 +120,6 @@ static int undotlock_file (const char *path) DL_EX_OK ? 0 : -1); } -#endif /* USE_DOTLOCK */ - /* looks up index of type for path in mxfmts */ static int mx_get_idx (const char* path) { int i = 0, t = 0; @@ -242,10 +235,8 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int time_out) } #endif /* USE_FLOCK */ -#ifdef USE_DOTLOCK if (r == 0 && dot) r = dotlock_file (path, time_out); -#endif /* USE_DOTLOCK */ if (r == -1) { /* release any other locks obtained in this routine */ @@ -280,10 +271,8 @@ int mx_unlock_file (const char *path, int fd, int dot) flock (fd, LOCK_UN); #endif -#ifdef USE_DOTLOCK if (dot) undotlock_file (path); -#endif return 0; } @@ -291,10 +280,7 @@ int mx_unlock_file (const char *path, int fd, int dot) static void mx_unlink_empty (const char *path) { int fd; - -#ifndef USE_DOTLOCK struct stat sb; -#endif if ((fd = open (path, O_RDWR)) == -1) return; @@ -304,12 +290,7 @@ static void mx_unlink_empty (const char *path) return; } -#ifdef USE_DOTLOCK - invoke_dotlock (path, DL_FL_UNLINK, 1); -#else - if (fstat (fd, &sb) == 0 && sb.st_size == 0) - unlink (path); -#endif + invoke_dotlock(path, DL_FL_UNLINK, 1); mx_unlock_file (path, fd, 0); close (fd); -- 2.20.1