msgbase.c: fixed tempfile naming problem that could cause a new
authorArt Cancro <ajc@citadel.org>
Wed, 16 Dec 1998 04:36:59 +0000 (04:36 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 16 Dec 1998 04:36:59 +0000 (04:36 +0000)
          outgoing netmail message to overwrite another if netproc had not been
          run in between

citadel/ChangeLog
citadel/aidepost.c
citadel/msgbase.c

index 8ba25f3fea2980dc3e1784f4f0b899f47e890c9b..ad69de7701ee383efb780c43e3c442c07c711795 100644 (file)
@@ -1,6 +1,9 @@
 1998-12-15 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * msgbase.c: remove extra call to alias() which was causing
          Citadel-to-Citadel mail to fall into the bit bucket.
+       * msgbase.c: fixed tempfile naming problem that could cause a new
+         outgoing netmail message to overwrite another if netproc had not been
+         run in between
 
 1998-12-14 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * More session table stability nonsense
index a54bc1e18d3751795ec1dbc7c7799e12c71d0422..04b9b86eeeb2c3594a32cf392d062e08c8aeca50 100644 (file)
@@ -51,8 +51,8 @@ int main(int argc, char **argv)
        char movecmd[256];
        
        get_config();
-       snprintf(tempbase,sizeof tempbase,"ap.%d",getpid());
-       snprintf(temptmp,sizeof temptmp,"/tmp/%s", tempbase);
+       snprintf(tempbase, sizeof tempbase,"ap.%d", getpid());
+       snprintf(temptmp, sizeof temptmp,"/tmp/%s", tempbase);
        snprintf(tempspool,sizeof tempspool,"./network/spoolin/%s", tempbase);
        make_message(temptmp);
 
index 296cfc2d18f603704ed032777f36f8346e2d18d5..abda41ed4fff5ecf93147fde3fa549721749792d 100644 (file)
@@ -718,6 +718,7 @@ void save_message(char *mtmp,       /* file containing proper message */
        FILE *fp;
        struct usersupp userbuf;
        int a;
+       static int seqnum = 0;
 
        lprintf(9, "save_message(%s,%s,%d,%d,%d)\n",
                mtmp, rec, mtsflag, mailtype, generate_id);
@@ -797,7 +798,8 @@ void save_message(char *mtmp,       /* file containing proper message */
 
        /* Network mail - send a copy to the network program. */
        if ( (strlen(recipient)>0) && (mailtype != M_LOCAL) ) {
-               sprintf(aaa,"./network/spoolin/nm.%d",getpid());
+               sprintf(aaa,"./network/spoolin/netmail.%04x.%04x.%04x",
+                       getpid(), CC->cs_pid, ++seqnum);
                copy_file(mtmp,aaa);
                system("exec nohup ./netproc >/dev/null 2>&1 &");
                }