* Don't delete temp file when composing message until after server writes
authorMichael Hampton <io_error@uncensored.citadel.org>
Wed, 4 Feb 2004 18:27:25 +0000 (18:27 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Wed, 4 Feb 2004 18:27:25 +0000 (18:27 +0000)
  it successfully (or an error occurs in the client itself).

citadel/ChangeLog
citadel/messages.c

index f86be0e3aa48ce56edbbaeb3a28eb39fe7428a69..bcfa0729153001cb33a732565cf6b91800808985 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 614.14  2004/02/04 18:27:25  error
+ * Don't delete temp file when composing message until after server writes
+   it successfully (or an error occurs in the client itself).
+
  Revision 614.13  2004/02/04 04:07:56  ajc
  * More work on LDAP connector
 
@@ -5261,3 +5265,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 49ce8fd74c3e7f33d7e797c5b33bed737a2b24d5..f55946e7d21fa34abf130b57ef88aaba4428211f 100644 (file)
@@ -1195,13 +1195,11 @@ int entmsg(CtdlIPC *ipc,
        /* Reopen the temp file that was created, so we can send it */
        fp = fopen(temp, "r");
 
-       /* Yes, unlink it now, so it doesn't stick around if we crash */
-       unlink(temp);
-
        if (!fp || !(message.text = load_message_from_file(fp))) {
                err_printf("*** Internal error while trying to save message!\n"
                        "%s: %s\n",
                        temp, strerror(errno));
+               unlink(temp);
                return(errno);
        }
 
@@ -1214,6 +1212,9 @@ int entmsg(CtdlIPC *ipc,
                return (1);
        }
 
+       /* Yes, unlink it now, so it doesn't stick around if we crash */
+       unlink(temp);
+
        if (num_msgs >= 1) highmsg = msgarr[num_msgs - 1];
 
        if (msgarr) free(msgarr);