X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/fb05276aaee4c27b6f20fb1f32290ee40a929064..f5d25c2b47ab0070114d211f0ed5e085aa87dc64:/src/src/spool_out.c diff --git a/src/src/spool_out.c b/src/src/spool_out.c index 82b606871..e49d89a09 100644 --- a/src/src/spool_out.c +++ b/src/src/spool_out.c @@ -17,7 +17,7 @@ *************************************************/ /* This function is called immediately after errors in writing the spool, with -errno still set. It creates and error message, depending on the circumstances. +errno still set. It creates an error message, depending on the circumstances. If errmsg is NULL, it logs the message and panic-dies. Otherwise errmsg is set to point to the message, and -1 is returned. This function makes the code of spool_write_header() a bit neater. @@ -36,22 +36,21 @@ static int spool_write_error(int where, uschar **errmsg, uschar *s, uschar *temp_name, FILE *f) { -uschar *msg = (where == SW_RECEIVING)? - string_sprintf("spool file %s error while receiving from %s: %s", s, - (sender_fullhost != NULL)? sender_fullhost : sender_ident, - strerror(errno)) - : - string_sprintf("spool file %s error while %s: %s", s, - (where == SW_DELIVERING)? "delivering" : "modifying", - strerror(errno)); - -if (temp_name != NULL) Uunlink(temp_name); -if (f != NULL) (void)fclose(f); - -if (errmsg == NULL) - log_write(0, LOG_MAIN|LOG_PANIC_DIE, "%s", msg); -else +uschar *msg = where == SW_RECEIVING + ? string_sprintf("spool file %s error while receiving from %s: %s", s, + sender_fullhost ? sender_fullhost : sender_ident, + strerror(errno)) + : string_sprintf("spool file %s error while %s: %s", s, + where == SW_DELIVERING ? "delivering" : "modifying", + strerror(errno)); + +if (temp_name) Uunlink(temp_name); +if (f) (void)fclose(f); + +if (errmsg) *errmsg = msg; +else + log_write(0, LOG_MAIN|LOG_PANIC_DIE, "%s", msg); return -1; }