X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/7f43588d73a29160724b497f9782a19d331fc73a..351a74de3e5d3cd2048d2ec4444b090c6b7e00ac:/uip/attach.c diff --git a/uip/attach.c b/uip/attach.c index 29024997..9ff7d095 100644 --- a/uip/attach.c +++ b/uip/attach.c @@ -100,12 +100,15 @@ attach(char *attachment_header_field_name, char *draft_file_name, * Make names for the temporary files. */ - (void)strncpy(body_file_name, - m_mktemp(m_maildir(invo_name), NULL, NULL), - body_file_name_len); - (void)strncpy(composition_file_name, - m_mktemp(m_maildir(invo_name), NULL, NULL), - composition_file_name_len); + if ((p = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) { + adios(NULL, "unable to create temporary file in %s", get_temp_dir()); + } + (void)strncpy(body_file_name, p, body_file_name_len); + if ((p = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) { + unlink(body_file_name); + adios(NULL, "unable to create temporary file in %s", get_temp_dir()); + } + (void)strncpy(composition_file_name, p, composition_file_name_len); if (has_body) body_file = fopen(body_file_name, "w");