015f87a
diff --git a/src/cstdio.c b/src/cstdio.c
604541d
index d444057..5327c77 100644
015f87a
--- a/src/cstdio.c
015f87a
+++ b/src/cstdio.c
015f87a
@@ -15,6 +15,7 @@ static /*const*/char rcsid[]=
015f87a
 #include "variables.h"
015f87a
 #include "shell.h"
015f87a
 #include "cstdio.h"
015f87a
+#include "common.h"
015f87a
 
015f87a
 static uchar rcbuf[STDBUF],*rcbufp,*rcbufend;	  /* buffer for custom stdio */
015f87a
 static off_t blasttell;
015f87a
diff --git a/src/foldinfo.c b/src/foldinfo.c
604541d
index 48b83e2..88d6228 100644
015f87a
--- a/src/foldinfo.c
015f87a
+++ b/src/foldinfo.c
604541d
@@ -19,6 +19,7 @@ static /*const*/char rcsid[]=
015f87a
 #include "goodies.h"
015f87a
 #include "locking.h"
015f87a
 #include "foldinfo.h"
015f87a
+#include "acommon.h"
015f87a
 
015f87a
 static const char
015f87a
  maildirtmp[]=MAILDIRtmp,maildircur[]=MAILDIRcur;
604541d
@@ -186,8 +187,8 @@ int screenmailbox(chp,egid,doautoforward)
015f87a
   if(!stat(buf,&stbuf))
015f87a
    { unsigned wwsdir;
015f87a
      accspooldir=(wwsdir=			/* world writable spool dir? */
015f87a
-	    ((S_IWGRP|S_IXGRP|S_IWOTH|S_IXOTH)&stbuf.st_mode)==
015f87a
-	     (S_IWGRP|S_IXGRP|S_IWOTH|S_IXOTH)
015f87a
+	    (((S_IWGRP|S_IXGRP|S_IWOTH|S_IXOTH)&stbuf.st_mode)==
015f87a
+	     (S_IWGRP|S_IXGRP|S_IWOTH|S_IXOTH))
015f87a
 	  <<1|						 /* note it in bit 1 */
015f87a
 	  uid==stbuf.st_uid);	   /* we own the spool dir, note it in bit 0 */
015f87a
      if((CAN_toggle_sgid||accspooldir)&&privileged)
015f87a
diff --git a/src/lmtp.c b/src/lmtp.c
604541d
index 60b7a2d..41e3c1a 100644
015f87a
--- a/src/lmtp.c
015f87a
+++ b/src/lmtp.c
604541d
@@ -52,7 +52,7 @@ static int lreaddyn P((void));
015f87a
 int childserverpid;
604541d
 char detaildelim='\0';
015f87a
 
015f87a
-static ctopfd;
015f87a
+static int ctopfd;
015f87a
 static char*overread;
015f87a
 static size_t overlen;
015f87a
 
015f87a
diff --git a/src/locking.c b/src/locking.c
604541d
index a5a0238..c6882ea 100644
015f87a
--- a/src/locking.c
015f87a
+++ b/src/locking.c
015f87a
@@ -95,7 +95,10 @@ faillock:  nlog("Lock failure on");logqnl(name);
015f87a
      permanent=nfsTRY;
015f87a
 ds:  ssleep((unsigned)locksleep);
015f87a
 ce:  if(nextexit)
015f87a
-term: { free(name);			     /* drop the preallocated buffer */
015f87a
+term: {
015f87a
+        if(nextexit)
015f87a
+          elog(whilstwfor),elog("lockfile"),logqnl(name);
015f87a
+        free(name);			     /* drop the preallocated buffer */
015f87a
 	break;
015f87a
       }
015f87a
    }
015f87a
@@ -103,7 +106,7 @@ term: { free(name);			     /* drop the preallocated buffer */
015f87a
      setegid(gid);		      /* we put back our regular permissions */
015f87a
   lcking&=~lck_DELAYSIG;
015f87a
   if(nextexit)
015f87a
-     elog(whilstwfor),elog("lockfile"),logqnl(name),Terminate();
015f87a
+     Terminate();
015f87a
   return !!*lockp;
015f87a
 }
015f87a