blob: 8341a8ecde8b983ec886dea0dda5fb626f21ba2e [file] [log] [blame]
From 898e9514bc889b4a540f667efed95a5af101c824 Mon Sep 17 00:00:00 2001
From: Li xin <lixin.fnst@cn.fujitsu.com>
Date: Tue, 2 Dec 2014 07:00:36 +0900
Subject: [PATCH 1/3] From debian to fix compile errors
Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
---
src/Makefile.0 | 7 +++----
src/autoconf | 64 +++++++++++++-------------------------------------------
src/comsat.c | 65 +++++++++++++++++++--------------------------------------
src/fields.c | 6 +++---
src/foldinfo.h | 2 +-
src/formail.c | 6 +++---
src/formisc.c | 2 +-
src/formisc.h | 2 +-
src/mailfold.c | 14 ++++++++++---
src/manconf.c | 2 +-
src/memblk.c | 24 ++++++++++-----------
src/memblk.h | 2 +-
src/network.h | 10 ++-------
src/pipes.c | 10 ++++-----
src/procmail.c | 3 +--
src/recommend.c | 2 +-
16 files changed, 81 insertions(+), 140 deletions(-)
diff --git a/src/Makefile.0 b/src/Makefile.0
index 6eb5b51..15a2039 100644
--- a/src/Makefile.0
+++ b/src/Makefile.0
@@ -40,7 +40,7 @@ multigram: multigram.$(O) $(MG_OBJ) setid
@cd ..; $(MAKE) config.check
_autotst: _autotst.$(O) sublib.c sublib.h
- $(CC) $(CFLAGS) $@.$(O) -o $@ $(LDFLAGS)
+ gcc $@.$(O) -o $@ $(LDFLAGS)
../autoconf.h: autoconf Makefile ../patchlevel.h
@echo No this was not make -n >make_n
@@ -175,17 +175,16 @@ recommend: recommend.$(O) sublib.$(O)
../man/man.sed: manconf.c ../autoconf.h ../config.h includes.h procmail.h
../man/man.sed: ../patchlevel.h
- @$(CC) $(CFLAGS) "-DBINDIR=\"$(VISIBLE_BINDIR)\"" -o _autotst \
+ gcc "-DBINDIR=\"$(VISIBLE_BINDIR)\"" -o _autotst \
manconf.c $(LDFLAGS)
@./_autotst $@
@echo Housekeeping file >$@
- @$(RM) _autotst
clean:
$(RM) -r _locktest
$(RM) procmail.$(O) $(PM_OBJ) lockfile.$(O) $(LF_OBJ) formail.$O \
$(FM_OBJ) multigram.$(O) $(MG_OBJ) $(BINSS) multigram ../autoconf.h \
- _autotst* lookfor _locktst* grepfor recommend recommend.$(O) manconf \
+ lookfor _locktst* grepfor recommend recommend.$(O) manconf \
_Makefile lock.log *core* targetdir.h setid setid.$(O) gethome \
gethome.$(O) make_n realloc.log
diff --git a/src/autoconf b/src/autoconf
index 1cb4c42..ff78048 100755
--- a/src/autoconf
+++ b/src/autoconf
@@ -68,8 +68,6 @@
# #define NOfsync
#Ok #define endpwent()
#Ok #define endgrent()
-#Ok #define endhostent()
-#Ok #define endservent()
#Ok #define endprotoent()
# #define h_0addr_list h_addr
#Ok #define NOpw_passwd
@@ -896,7 +894,7 @@ int main(){int i=0;
{uid_t vuid_t;i+=vuid_t=1;}
{gid_t vgid_t;i+=vgid_t=1;}
#ifndef NO_COMSAT
- {struct hostent vhostent;i+=!(vhostent.h_addr_list=0);}
+ {struct addrinfo res; i+=!(res.ai_socktype=0);}
#endif
#ifndef NOuname
{struct utsname vutsname;i+=!(*vutsname.nodename='\0');}
@@ -917,8 +915,6 @@ do
test -z "$i3" && grepfor mode_t 'typedef int mode_t;' && i3=I
test -z "$i4" && grepfor uid_t 'typedef int uid_t;' && i4=I
test -z "$i5" && grepfor gid_t 'typedef int gid_t;' && i5=I
- test -z "$i6" && grepfor h_addr_list '#define h_0addr_list h_addr' && i6=I
- test -z "$i6" && grepfor hostent '#define h_0addr_list h_addr' && i6=I
test -z "$i6" && grepfor member '#define h_0addr_list h_addr' && i6=I
test -z "$i7" && grepfor utsname "#define NOuname \
/* <sys/utsname.h> is there, but empty */" && i7=I
@@ -1048,8 +1044,12 @@ int main(){char a[2];
{struct utsname b;uname(&b);}
#endif
#ifndef NO_COMSAT
- gethostbyname("0");getprotobyname(COMSATprotocol);endhostent();endservent();
- endprotoent();
+ {
+ struct addrinfo *res, hints;
+ memset(&hints, '\0', sizeof(hints));
+ if(getaddrinfo(COMSAThost,BIFF_serviceport,&hints,&res))
+ freeaddrinfo(res);
+ }
#endif
_exit(0);
return 0;}
@@ -1103,14 +1103,9 @@ grepfor uname "\
/* <sys/utsname.h> defines it, the libraries don't */"
grepfor endpwent '#define endpwent()'
grepfor endgrent '#define endgrent()'
-if grepfor gethostbyname '#define NO_COMSAT'
+if grepfor getaddrinfo '#define NO_COMSAT'
then
:
-else
- grepfor getprotobyname '#define UDP_protocolno 17'
- grepfor endhostent '#define endhostent()'
- grepfor endservent '#define endservent()'
- grepfor endprotoent '#define endprotoent()'
fi
grepfor strstr '#define SLOWstrstr' ||
grepfor clock '#define SLOWstrstr'
@@ -1239,39 +1234,9 @@ int main(argc,argv)int argc;const char*argv[];
printf("/* Insufficient memory to perform the benchmark! */\n");
#endif /* SLOWstrstr */
#ifndef NO_COMSAT
-#ifndef UDP_protocolno
- ;{ const struct protoent*p;
- if(p=getprotobyname(COMSATprotocol))
- { printf("#define UDP_protocolno %d\n",p->p_proto);
-#else
- ;{ if(1)
- {
-#endif
- ;{ const struct servent*serv;
- if(serv=getservbyname(COMSATservice,COMSATprotocol))
- printf("#define BIFF_serviceport \"%d\"\n",
- ntohs(serv->s_port));
- }
-#ifdef AF_INET
- ;{ const struct hostent*host;
- if(!strcmp("localhost",COMSAThost)&&
- (host=gethostbyname(COMSAThost))&&
- host->h_0addr_list&&host->h_addrtype==AF_INET&&
- host->h_length)
- { int j=host->h_length;
- const unsigned char*ad=(void*)host->h_0addr_list;
- printf("#define IP_localhost {");
- printf("%d",*ad++);
- while(--j)
- printf(",%d",*ad++);
- puts("}");
- }
- }
+#ifndef AF_INET
+ puts("#define NO_COMSAT");
#endif /* AF_INET */
- }
- else
- puts("#define NO_COMSAT");
- }
#endif /* NO_COMSAT */
;{ unsigned long s=(size_t)~0;int bits;
for(bits=1;s>>=1;bits++);
@@ -1470,15 +1435,14 @@ cat /usr/lib/sendmail.cf /etc/sendmail.cf /etc/mail/sendmail.cf 2>$DEVNULL |
grep 'Mlocal.*procmail' >$DEVNULL ||
echo '#define CF_no_procmail_yet' >>$ACONF
-cat /usr/lib/sendmail.cf /etc/sendmail.cf /etc/mail/sendmail.cf 2>$DEVNULL |
- grep '^V' >$DEVNULL ||
- echo '#define buggy_SENDMAIL' >>$ACONF
+# cat /usr/lib/sendmail.cf /etc/sendmail.cf /etc/mail/sendmail.cf 2>$DEVNULL |
+# grep '^V' >$DEVNULL ||
+# echo '#define buggy_SENDMAIL' >>$ACONF
lpath='/bin'
bins="/bin"
-for newd in /usr/bin /usr/ucb /usr/5bin $BINDIR /local/bin /usr/local/bin \
- /global/bin /usr/bin/X11 /usr/X*/bin
+for newd in /usr/bin $BINDIR /usr/bin/X11 /usr/X*/bin
do
if test -d $newd
then
diff --git a/src/comsat.c b/src/comsat.c
index 77dba34..5082b16 100644
--- a/src/comsat.c
+++ b/src/comsat.c
@@ -27,7 +27,8 @@ static /*const*/char rcsid[]=
#include "comsat.h"
static int csvalid; /* is it turned on with a good address? */
-static struct sockaddr_in csaddr;
+static struct addrinfo cai;
+static struct sockaddr *csaddr;
static char*cslastf,*cslgname;
void setlfcs(folder)const char*folder; /* set lastfolder for comsat */
@@ -62,56 +63,32 @@ void setlgcs(name)const char*name; /* set logname for comsat */
}
int setcomsat(chp)const char*chp;
-{ char*chad;int newvalid; struct sockaddr_in newaddr;
+{ char*chad;int newvalid; struct addrinfo *res, hints;
chad=strchr(chp,SERV_ADDRsep); /* @ separator? */
if(!chad&&!renvint(-1L,chp))
return csvalid=0; /* turned off comsat */
newvalid=1;
if(chad)
*chad++='\0'; /* split the specifier */
+ if(!chad||!*chp) /* no service */
+ chp=BIFF_serviceport; /* new balls please! */
if(!chad||!*chad) /* no host */
-#ifndef IP_localhost /* Is "localhost" preresolved? */
chad=COMSAThost; /* nope, use default */
-#else /* IP_localhost */
- { static const unsigned char ip_localhost[]=IP_localhost;
- newaddr.sin_family=AF_INET;
- tmemmove(&newaddr.sin_addr,ip_localhost,sizeof ip_localhost);
- }
- else
-#endif /* IP_localhost */
- { const struct hostent*host; /* what host? paranoid checks */
- if(!(host=gethostbyname(chad))||!host->h_0addr_list)
- { bbzero(&newaddr.sin_addr,sizeof newaddr.sin_addr);
- newvalid=0; /* host can't be found, too bad */
- }
- else
- { newaddr.sin_family=host->h_addrtype; /* address number found */
- tmemmove(&newaddr.sin_addr,host->h_0addr_list,host->h_length);
- }
- endhostent();
- }
- if(newvalid) /* so far, so good */
- { int s;
- if(!*chp) /* no service */
- chp=BIFF_serviceport; /* new balls please! */
- s=strtol(chp,&chad,10);
- if(chp!=chad) /* the service is not numeric */
- newaddr.sin_port=htons((short)s); /* network order */
- else
- { const struct servent*serv;
- serv=getservbyname(chp,COMSATprotocol); /* so get its no. */
- if(serv)
- newaddr.sin_port=serv->s_port;
- else
- { newaddr.sin_port=htons((short)0); /* no such service */
- newvalid=0;
- }
- endservent();
- }
- }
+ bzero(&hints,sizeof(hints));
+ hints.ai_socktype=SOCK_DGRAM;
+ hints.ai_flags=AI_ADDRCONFIG;
+ if(getaddrinfo(chad,chp,&hints,&res))
+ newvalid=0;
+
onguard(); /* update the address atomically */
if(csvalid=newvalid)
- tmemmove(&csaddr,&newaddr,sizeof(newaddr));
+ { if(csaddr)
+ free(csaddr);
+ csaddr=malloc(res->ai_addrlen);
+ tmemmove(csaddr,res->ai_addr,res->ai_addrlen);
+ tmemmove(&cai,res,sizeof(cai));
+ freeaddrinfo(res);
+ }
offguard();
return newvalid;
}
@@ -120,7 +97,7 @@ void sendcomsat(folder)const char*folder;
{ int s;const char*p;
if(!csvalid||!buf) /* is comat on and set to a valid address? */
return;
- if(!*cslgname||strlen(cslgname)+2>linebuf) /* is $LOGNAME bogus? */
+ if(!cslgname||!*cslgname||strlen(cslgname)+2>linebuf)/* is $LOGNAME bogus? */
return;
if(!(p=folder?folder:cslastf)) /* do we have a folder? */
return;
@@ -132,8 +109,8 @@ void sendcomsat(folder)const char*folder;
}
strlcat(buf,COMSATxtrsep,linebuf); /* custom seperator */
strlcat(buf,p,linebuf); /* where was it delivered? */
- if((s=socket(AF_INET,SOCK_DGRAM,UDP_protocolno))>=0)
- { sendto(s,buf,strlen(buf),0,(struct sockaddr*)&csaddr,sizeof(csaddr));
+ if((s=socket(cai.ai_family,cai.ai_socktype,cai.ai_protocol))>=0)
+ { sendto(s,buf,strlen(buf),0,csaddr,cai.ai_addrlen);
rclose(s);
yell("Notified comsat:",buf);
}
diff --git a/src/fields.c b/src/fields.c
index a2bd77f..37ed154 100644
--- a/src/fields.c
+++ b/src/fields.c
@@ -110,16 +110,16 @@ void dispfield(p)register const struct field*p;
/* try and append one valid field to rdheader from stdin */
int readhead P((void))
{ int idlen;
- getline();
+ get_line();
if((idlen=breakfield(buf,buffilled))<=0) /* not the start of a valid field */
return 0;
if(idlen==STRLEN(FROM)&&eqFrom_(buf)) /* it's a From_ line */
{ if(rdheader)
return 0; /* the From_ line was a fake! */
- for(;buflast=='>';getline()); /* gather continued >From_ lines */
+ for(;buflast=='>';get_line()); /* gather continued >From_ lines */
}
else
- for(;;getline()) /* get the rest of the continued field */
+ for(;;get_line()) /* get the rest of the continued field */
{ switch(buflast) /* will this line be continued? */
{ case ' ':case '\t': /* yep, it sure is */
continue;
diff --git a/src/foldinfo.h b/src/foldinfo.h
index 9e4ebb6..797f9be 100644
--- a/src/foldinfo.h
+++ b/src/foldinfo.h
@@ -10,7 +10,7 @@
#define ft_lock(type) ((type)>ft_MAILDIR) /* kernel lock fd */
#define ft_atime(type) ((type)==ft_FILE) /* force atime < mtime */
-#define ft_dotlock(type) ((type)==ft_FILE) /* dotlock $DEFAULT */
+#define ft_dotlock(type) ((type)>ft_MAILDIR) /* dotlock $DEFAULT */
#define ft_delim(type) ((type)==ft_FILE) /* add MMDF delim */
#define ft_checkcloser(type) ((type)>ft_MH)
#define ft_forceblank(type) ((type)!=ft_MAILDIR) /* force blank line at end */
diff --git a/src/formail.c b/src/formail.c
index fe5e6be..1f5c9dd 100644
--- a/src/formail.c
+++ b/src/formail.c
@@ -758,9 +758,9 @@ startover:
lputssn(buf,buffilled),ctlength-=buffilled,buffilled=lnl=0;
;{ int tbl=buflast,lwr='\n';
while(--ctlength>=0&&tbl!=EOF) /* skip Content-Length: bytes */
- lnl=lwr==tbl&&lwr=='\n',putcs(lwr=tbl),tbl=getchar();
+ lnl=lwr==tbl&&lwr=='\n',lputcs(lwr=tbl),tbl=getchar();
if((buflast=tbl)=='\n'&&lwr!=tbl) /* just before a line break? */
- putcs('\n'),buflast=getchar(); /* wrap up loose end */
+ lputcs('\n'),buflast=getchar(); /* wrap up loose end */
}
if(!quiet&&ctlength>0)
{ charNUM(num,ctlength);
@@ -819,7 +819,7 @@ splitit: { if(!lnl) /* did the previous mail end with an empty line? */
{ if(split) /* gobble up the next start separator */
{ buffilled=0;
#ifdef sMAILBOX_SEPARATOR
- getline();buffilled=0; /* but only if it's defined */
+ get_line();buffilled=0; /* but only if it's defined */
#endif
if(buflast!=EOF) /* if any */
goto splitit;
diff --git a/src/formisc.c b/src/formisc.c
index d6cab90..338733b 100644
--- a/src/formisc.c
+++ b/src/formisc.c
@@ -115,7 +115,7 @@ void loadchar(c)const int c; /* append one character to buf */
buf[buffilled++]=c;
}
-int getline P((void)) /* read a newline-terminated line */
+int get_line P((void)) /* read a newline-terminated line */
{ if(buflast==EOF) /* at the end of our Latin already? */
{ loadchar('\n'); /* fake empty line */
return EOF; /* spread the word */
diff --git a/src/formisc.h b/src/formisc.h
index 1c4ca20..f25211c 100644
--- a/src/formisc.h
+++ b/src/formisc.h
@@ -17,4 +17,4 @@ void
char*
skipwords P((char*start));
int
- getline P((void));
+ get_line P((void));
diff --git a/src/mailfold.c b/src/mailfold.c
index 917b502..6c8bcf4 100644
--- a/src/mailfold.c
+++ b/src/mailfold.c
@@ -30,6 +30,7 @@ static /*const*/char rcsid[]=
int logopened,rawnonl;
off_t lasttell;
+static int trunced;
static long lastdump;
static volatile int mailread; /* if the mail is completely read in already */
static struct dyna_array confield; /* escapes, concatenations */
@@ -81,6 +82,7 @@ long dump(s,type,source,len)const int s,type;const char*source;
long len;
{ int i;long part;
lasttell=i= -1;SETerrno(EBADF);
+ trunced=0;
if(s>=0)
{ if(ft_lock(type)&&(lseek(s,(off_t)0,SEEK_END),fdlock(s)))
nlog("Kernel-lock failed\n");
@@ -120,13 +122,18 @@ jin: while(part&&(i=rwrite(s,source,BLKSIZ<part?BLKSIZ:(int)part)))
}
writefin:
i=type!=ft_PIPE&&fsync(s)&&errno!=EINVAL; /* EINVAL => wasn't a file */
+ if ((i||len)&&lasttell>=0)
+ { int serrno=errno;
+ if(!ftruncate(s,lasttell)) trunced=1;
+ SETerrno(serrno);
+ }
if(ft_lock(type))
{ int serrno=errno; /* save any error information */
if(fdunlock())
nlog("Kernel-unlock failed\n");
SETerrno(serrno);
}
- i=rclose(s)||i;
+ i=rclose(s)||i; /* if this fails, we should truncate, but it's too late */
} /* return an error even if nothing was to be sent */
return i&&!len?-1:len;
}
@@ -237,7 +244,7 @@ dumpf: { switch(errno)
#endif
default:writeerr(buf);
}
- if(lasttell>=0&&!truncate(boxname,lasttell)&&(logopened||verbose))
+ if(lasttell>=0&&trunced&&(logopened||verbose))
nlog("Truncated file to former size\n"); /* undo garbage */
ret0: return 0;
}
@@ -378,7 +385,8 @@ void readmail(rhead,tobesent)const long tobesent;
dfilled=mailread=0;
else if(rhead) /* only read in a new header */
{ memblk new;
- dfilled=mailread=0;makeblock(&new,0);readdyn(&new,&dfilled,0);
+ dfilled=mailread=0;makeblock(&new,0);
+ readdyn(&new,&dfilled,thebody-themail.p);
if(tobesent>dfilled&&isprivate) /* put it in place here */
{ tmemmove(themail.p+dfilled,thebody,filled-=tobesent);
tmemmove(themail.p,new.p,dfilled);
diff --git a/src/manconf.c b/src/manconf.c
index a9e9f1c..5c8ec36 100644
--- a/src/manconf.c
+++ b/src/manconf.c
@@ -233,7 +233,7 @@ a security violation was found (e.g. \1.B \2-@PRESERVOPT@\1or variable\
\2-@PRESERVOPT@\1and\1.BR \2-@FROMWHOPT@ .\1");
pc("LMTPOPT",LMTPOPT);
#else
- ps("LMTPOPTdesc","");ps("LMTPusage","");
+ ps("LMTPOPTdesc","");ps("LMTPusage","\1");
#endif
pname("INIT_UMASK",0);printf("0%lo/g\n",(unsigned long)INIT_UMASK);lines--;
pn("DEFlinebuf",DEFlinebuf);
diff --git a/src/memblk.c b/src/memblk.c
index e2f13f0..97e02d3 100644
--- a/src/memblk.c
+++ b/src/memblk.c
@@ -51,11 +51,11 @@ void lockblock(mb)memblk*const mb;
{
#ifdef USE_MMAP
if(mb->fd>=0)
- { long len=mb->len+1;
- if(munmap(mb->p,len))
- mmapfailed(len); /* don't want to continue here */
- if((mb->p=mmap(0,len,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED)
- mmapfailed(len);
+ { long mlen=mb->len+1;
+ if(munmap(mb->p,mlen))
+ mmapfailed(mlen); /* don't want to continue here */
+ if((mb->p=mmap(0,mlen,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED)
+ mmapfailed(mlen);
close(mb->fd);
mb->fd=ropen(devnull,O_RDWR,0); /* XXX Perhaps -1 is better? */
}
@@ -77,8 +77,8 @@ int resizeblock(mb,len,nonfatal)memblk*const mb;const long len;
strcpy(filename,MMAP_DIR);
if(unique(filename,strchr(filename,'\0'),MMAP_FILE_LEN,MMAP_PERM,0,0)&&
(mb->fd=ropen(filename,O_RDWR,MMAP_PERM),unlink(filename),mb->fd>=0))
- { mb->filelen=len;
- if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
+ { mb->filelen=len+1;
+ if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
dropf: { close(mb->fd);mb->fd= -1;
if(verbose)nlog("Unable to extend or use tempfile");
}
@@ -98,9 +98,9 @@ dropf: { close(mb->fd);mb->fd= -1;
}
}
if(mb->fd>=0)
- { if(len>mb->filelen) /* need to extend? */
- { mb->filelen=len;
- if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
+ { if(len>=mb->filelen) /* need to extend? */
+ { mb->filelen=len+1;
+ if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
{ char*p=malloc(len+1); /* can't extend, switch to malloc */
tmemmove(p,mb->p,mb->len);
munmap(mb->p,mb->len+1);
@@ -124,9 +124,9 @@ mmap: if((mb->p=mmap(0,len+1,P_RW,MAP_SHARED,mb->fd,(off_t)0))==MAP_FAILED)
}
else
mb->p=realloc(mb->p,len+1);
- mb->len=len+1;
- mb->p[len]='\0';
+ mb->len=len;
ret1:
+ mb->p[len]='\0';
return 1;
}
diff --git a/src/memblk.h b/src/memblk.h
index 6fd1d1d..b57f369 100644
--- a/src/memblk.h
+++ b/src/memblk.h
@@ -1,6 +1,6 @@
typedef struct memblk {
char*p; /* where it starts */
- long len; /* currently allocated size */
+ long len; /* current size, not including trailing NUL */
#ifdef USE_MMAP
off_t filelen; /* how long is the file */
int fd; /* file which is mmap()ed */
diff --git a/src/network.h b/src/network.h
index d7d08f2..b09b6c4 100644
--- a/src/network.h
+++ b/src/network.h
@@ -1,19 +1,13 @@
/*$Id: network.h,v 1.7 1997/04/02 03:15:41 srb Exp $*/
-#include <sys/socket.h> /* socket() sendto() AF_INET
+#include <sys/socket.h> /* socket() sendto() */
/* SOCK_DGRAM */
-#include <netdb.h> /* gethostbyname() getservbyname()
- /* getprotobyname() */
-#include <netinet/in.h> /* htons() struct sockaddr_in */
+#include <netdb.h> /* getaddrinfo() */
#ifndef BIFF_serviceport
#define BIFF_serviceport COMSATservice
#endif
-#ifndef h_0addr_list
-#define h_0addr_list h_addr_list[0] /* POSIX struct member */
-#endif
-
#ifndef NO_const /* since network.h is outside the autoconf const check */
#ifdef const /* loop, we need this backcheck for some systems */
#undef const
diff --git a/src/pipes.c b/src/pipes.c
index 1fdb9e6..7754300 100644
--- a/src/pipes.c
+++ b/src/pipes.c
@@ -145,7 +145,9 @@ int pipthrough(line,source,len)char*line,*source;const long len;
if(Stdout)
{ *(eq=strchr(Stdout,'\0')-1)='\0'; /* chop the '=' */
if(!(backblock=getenv(Stdout))) /* no current value? */
- PRDB=PWRB= -1;
+ { PRDB=PWRB= -1;
+ backlen=0;
+ }
else
{ backlen=strlen(backblock);
goto pip;
@@ -155,9 +157,7 @@ int pipthrough(line,source,len)char*line,*source;const long len;
pip: rpipe(pbackfd);
rpipe(pinfd); /* main pipes setup */
if(!(pidchild=sfork())) /* create a sending procmail */
- { if(Stdout&&backblock)
- backlen=strlen(backblock);
- else
+ { if(!Stdout)
backblock=source,backlen=len;
childsetup();rclose(PRDI);rclose(PRDB);
rpipe(poutfd);rclose(STDOUT);
@@ -194,7 +194,7 @@ perr: progerr(line,excode,pwait==4); /* I'm going to tell my mommy! */
makeblock(&temp,Stdfilled);
tmemmove(temp.p,Stdout,Stdfilled);
readdyn(&temp,&Stdfilled,Stdfilled+backlen+1);
- Stdout=realloc(Stdout,&Stdfilled+1);
+ Stdout=realloc(Stdout,Stdfilled+1);
tmemmove(Stdout,temp.p,Stdfilled+1);
freeblock(&temp);
retStdout(Stdout,pwait&&pipw,!backblock);
diff --git a/src/procmail.c b/src/procmail.c
index 4a232f2..2bb449b 100644
--- a/src/procmail.c
+++ b/src/procmail.c
@@ -652,8 +652,7 @@ commint:do skipspace(); /* skip whitespace */
nrcond= -1;
if(tolock) /* clear temporary buffer for lockfile name */
free(tolock);
- for(i=maxindex(flags);i;i--) /* clear the flags */
- flags[i]=0;
+ bbzero(flags,sizeof(flags)); /* clear the flags */
for(tolock=0,locknext=0;;)
{ chp=skpspace(chp);
switch(i= *chp++)
diff --git a/src/recommend.c b/src/recommend.c
index 5d41e01..9002268 100644
--- a/src/recommend.c
+++ b/src/recommend.c
@@ -47,7 +47,7 @@ int main(argc,argv)const int argc;const char*const argv[];
printf("chmod %lo %s\n",(unsigned long)(sgid|PERMIS),argv[2]);
else if(chmdir==1)
goto nogchmod;
- if(chmdir)
+ if(0)
printf("chmod %c+w %s/.\n",chmdir==1?'g':'a',mailspooldir);
nogchmod:
return EXIT_SUCCESS;
--
1.8.4.2