Fixed a bug that could cause us to keep a temporary file open.
authorDave West <davew@uncensored.citadel.org>
Tue, 16 Oct 2007 13:10:20 +0000 (13:10 +0000)
committerDave West <davew@uncensored.citadel.org>
Tue, 16 Oct 2007 13:10:20 +0000 (13:10 +0000)
When moving the network temporary spool file to the permanent spool
file, if the fopen of the permanent spool file fails then the temporary
spool file was not closed.

citadel/modules/network/serv_network.c

index f64d604e5f953d5275822d0d19d15496ceade5ff..31312796243b468174b55661c9478ace5763e4f8 100644 (file)
@@ -431,8 +431,8 @@ void cmd_snet(char *argbuf) {
                                fprintf(newfp, "%s", buf);
                        }
                        fclose(newfp);
-                       fclose(fp);
                }
+               fclose(fp);
        }
        end_critical_section(S_NETCONFIGS);
        unlink(tempfilename);
@@ -1746,8 +1746,8 @@ void receive_spool(int sock, char *remote_nodename) {
                                fprintf(newfp, "%s", buf);
                        }
                        fclose(newfp);
-                       fclose(fp);
                }
+               fclose(fp);
        }
        end_critical_section(S_NETSPOOL);
        unlink(tempfilename);