* Fixed generation of unique file names for network uploads etc.
authorArt Cancro <ajc@citadel.org>
Tue, 19 Dec 2000 20:41:55 +0000 (20:41 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 19 Dec 2000 20:41:55 +0000 (20:41 +0000)
citadel/ChangeLog
citadel/file_ops.c

index 50b0b1a0ed3e702de3bee3a9c4bd21b17eafa026..45841cc26edaeca6400033b4b22aa5b739fb60d2 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 573.52  2000/12/19 20:41:55  ajc
+ * Fixed generation of unique file names for network uploads etc.
+
  Revision 573.51  2000/12/14 18:36:34  ajc
  * Fixed the "users not in chat" wholist display
 
@@ -2225,3 +2228,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index e2db9eb56396bf8e9bcf393f0f39bba79f3c8dfc..fed2c0d890c4532137fa095958d8af768d1e0b3a 100644 (file)
@@ -134,6 +134,7 @@ void cmd_netf(char *cmdbuf)
        int a,e;
        time_t now;
        FILE *ofp;
+       static int seq = 1;
 
        extract(filename,cmdbuf,0);
        extract(destsys,cmdbuf,1);
@@ -167,8 +168,9 @@ void cmd_netf(char *cmdbuf)
                        ERROR+NO_SUCH_SYSTEM,destsys);
                return;
                }
-       snprintf(outfile,sizeof outfile,"%s/network/spoolin/nsf.%d",BBSDIR,
-                getpid());
+       snprintf(outfile, sizeof outfile,
+               "%s/network/spoolin/nsf.%04x.%04x",
+               BBSDIR, getpid(), ++seq);
        ofp=fopen(outfile,"a");
        if (ofp==NULL) {
                cprintf("%d internal error\n",ERROR);
@@ -670,6 +672,8 @@ void cmd_ndop(char *cmdbuf)
  */
 void cmd_nuop(char *cmdbuf)
 {
+       static int seq = 1;
+
        if (strlen(CC->net_node)==0) {
                cprintf("%d Not authenticated as a network node.\n",
                        ERROR+NOT_LOGGED_IN);
@@ -681,8 +685,9 @@ void cmd_nuop(char *cmdbuf)
                return;
                }
 
-       snprintf(CC->upl_path,sizeof CC->upl_path,"%s/network/spoolin/%s.%d",
-               BBSDIR,CC->net_node,getpid());
+       snprintf(CC->upl_path, sizeof CC->upl_path,
+               "%s/network/spoolin/%s.%04x.%04x",
+               BBSDIR, CC->net_node, getpid(), ++seq);
 
        CC->upload_fp = fopen(CC->upl_path,"r");
        if (CC->upload_fp != NULL) {