From: Michael Hampton Date: Wed, 4 Feb 2004 18:27:25 +0000 (+0000) Subject: * Don't delete temp file when composing message until after server writes X-Git-Tag: v7.86~5635 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=21c3042a3a71ac64be628627d35874a85d3590fe;p=citadel.git * Don't delete temp file when composing message until after server writes it successfully (or an error occurs in the client itself). --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index f86be0e3a..bcfa07291 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/messages.c b/citadel/messages.c index 49ce8fd74..f55946e7d 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -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);