*** Makefile% Sat Apr 3 00:22:07 1999 --- Makefile Mon Dec 20 17:48:06 1999 *************** *** 2,8 **** # BASENAME should point to where the whole lot will be installed # change BASENAME to your home directory if need be ! BASENAME = /usr # For display in the man pages VISIBLE_BASENAME= $(BASENAME) --- 2,8 ---- # BASENAME should point to where the whole lot will be installed # change BASENAME to your home directory if need be ! BASENAME = /usr/local # For display in the man pages VISIBLE_BASENAME= $(BASENAME) *************** *** 65,71 **** # Only edit below this line if you *think* you know what you are doing # ######################################################################## ! #LOCKINGTEST=100 # Uncomment (and change) if you think you know # it better than the autoconf lockingtests. # This will cause the lockingtests to be hotwired. # 100 to enable fcntl() --- 65,71 ---- # Only edit below this line if you *think* you know what you are doing # ######################################################################## ! LOCKINGTEST=100 # Uncomment (and change) if you think you know # it better than the autoconf lockingtests. # This will cause the lockingtests to be hotwired. # 100 to enable fcntl() *************** *** 86,93 **** #-Wimplicit -Wshadow -Wid-clash-6 #-Wuninitialized # The place to put your favourite extra cc flag ! CFLAGS0 = -O #$(GCC_WARNINGS) ! LDFLAGS0= -s # Read my libs :-) LIBS= --- 86,92 ---- #-Wimplicit -Wshadow -Wid-clash-6 #-Wuninitialized # The place to put your favourite extra cc flag ! CFLAGS0 = -g -DUSE_LOCAL_LOCK -DUSE_ORGMAILSIZE_VAR -DUSE_DEFAULTSIZE_VAR -DUSE_BERKELEY_FMT -DUSE_OUT_VAR #$(GCC_WARNINGS) LDFLAGS0= -s # Read my libs :-) LIBS= *** src/formail.c% Tue Nov 16 09:31:10 1999 --- src/formail.c Mon Dec 20 17:40:44 1999 *************** *** 361,367 **** --- 361,371 ---- int main(lastm,argv)int lastm;const char*const argv[]; { int i,split=0,force=0,bogus=1,every=0,headreply=0,digest=0,nowait=0,keepb=0, minfields=(char*)progid-(char*)progid,conctenate=0,babyl=0,babylstart, + #ifdef USE_BERKELEY_FMT + berkeley=1,forgetclen; + #else berkeley=0,forgetclen; + #endif /* USE_BERKELEY_FMT */ off_t maxlen,ctlength;FILE*idcache=0;pid_t thepid; size_t j,lnl,escaplen;char*chp,*namep,*escap=ESCAP; struct field*fldp,*fp2,**afldp,*fdate,*fcntlength,*fsubject,*fFrom_; *** src/locking.c% Wed Oct 20 08:42:47 1999 --- src/locking.c Mon Dec 20 17:43:17 1999 *************** *** 40,45 **** --- 40,49 ---- #endif ; } + #ifdef USE_LOCAL_LOCK + if (locallockit(name)) + goto term; + #endif /* USE_LOCAL_LOCK */ for(lcking|=lck_LOCKFILE;;) { yell("Locking",name); /* in order to cater for clock skew: get */ if(!xcreat(name,LOCKperm,&t,locktype)) /* time t from the filesystem */ *************** *** 101,106 **** --- 105,180 ---- elog(whilstwfor),elog("lockfile"),logqnl(name),Terminate(); } + #ifdef USE_LOCAL_LOCK + + #define TMPDIR "/tmp/" + #define TMPDIRLEN 5 + + locallockit(name)char*name; + { int triedforce=0,locktype=doLOCK;struct stat stbuf;time_t t; + char *localonlyname,*l,*m; + if (name[0] == '/') { + localonlyname=malloc(TMPDIRLEN+strlen(name)+2); + strcat(strcpy(localonlyname,TMPDIR),name); + for (l=localonlyname+TMPDIRLEN;*l;l++) if (*l=='/') *l='!'; /* emacs-like */ + } else { + if ((m=(char *)tgetenv(maildir)) == NULL) m=""; else m++; + localonlyname=malloc(TMPDIRLEN+strlen(m)+strlen(name)+2); + strcat(strcat(strcat(strcpy(localonlyname,TMPDIR),m),"/"),name); + for (l=localonlyname+TMPDIRLEN+1;*l;l++) if (*l=='/') *l='!'; /* emacs-like */ + } + for(;;) + { yell("Locking",localonlyname); + if(!xcreat(localonlyname,LOCKperm,&t,locktype)) + return 0; + switch(errno) + { case EEXIST: + if(!lstat(localonlyname,&stbuf)&& + stbuf.st_size<=MAX_locksize&&locktimeout&& + !lstat(localonlyname,&stbuf)&&locktimeout