diff -u orig/qlist.c ./qlist.c --- orig/qlist.c Fri Feb 21 22:59:19 1997 +++ ./qlist.c Fri Feb 21 23:09:50 1997 @@ -152,6 +152,7 @@ int fdout; int match; int flagwasthere; + int flagseenlist; ++numcommands; @@ -160,9 +161,10 @@ if (fdin == -1) goto badlock; fdout = open_trunc(qtemplist); if (fdout == -1) goto badinlock; - if (chmod(qtemplist,0700) == -1) goto badoutinlock; + if (chmod(qtemplist,0600) == -1) goto badoutinlock; flagwasthere = 0; + flagseenlist = 0; substdio_fdbuf(&subin,read,fdin,subinbuf,sizeof(subinbuf)); substdio_fdbuf(&subout,write,fdout,suboutbuf,sizeof(suboutbuf)); @@ -170,6 +172,7 @@ { if (getline2(&subin,&subline,&match,'\n') == -1) goto badoutinlock; if (!match) break; /* goodbye partial lines */ + if (!str_diffn(subline.s,"+list\n", 6)) flagseenlist = 1; if (subline.len == str_len(target) + 2) if (!str_diffn(subline.s + 1,target,subline.len - 2)) if (subline.s[0] == '&') @@ -181,6 +184,9 @@ if (substdio_put(&subout,subline.s,subline.len) == -1) goto badoutinlock; } + if (flagadd && !flagseenlist) + if (substdio_puts(&subout,"+list\n") == -1) goto badoutinlock; + if (flagadd && !flagwasthere) { if (substdio_puts(&subout,"&") == -1) goto badoutinlock; @@ -192,7 +198,7 @@ close(fdout); close(fdin); if (rename(qtemplist,qmaillist) == -1) goto badlock; - if (chmod(qmaillist,0500) == -1) goto badlock; + if (chmod(qmaillist,0400) == -1) goto badlock; lock_un(fdlock);