X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/4ea717b986c4b0ce9ccd01687c7b50bd2ab227ca..a2806483a53fcdb62ca8e2bec4f4e023355f4470:/uip/mhstoresbr.c diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index fab16800..7b1dbd51 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -135,13 +135,11 @@ store_switch (CT ct) switch (ct->c_type) { case CT_MULTIPART: return store_multi (ct); - break; case CT_MESSAGE: switch (ct->c_subtype) { case MESSAGE_PARTIAL: return store_partial (ct); - break; case MESSAGE_EXTERNAL: return store_external (ct); @@ -149,24 +147,19 @@ store_switch (CT ct) case MESSAGE_RFC822: default: return store_generic (ct); - break; } - break; case CT_APPLICATION: return store_application (ct); - break; case CT_TEXT: case CT_AUDIO: case CT_IMAGE: case CT_VIDEO: return store_generic (ct); - break; default: adios (NULL, "unknown content type %d", ct->c_type); - break; } return OK; /* NOT REACHED */ @@ -569,7 +562,10 @@ store_content (CT ct, CT p) char *tmpfilenam, *folder; /* Store content in temporary file for now */ - tmpfilenam = m_mktemp(invo_name, NULL, NULL); + if ((tmpfilenam = m_mktemp(invo_name, NULL, NULL)) == NULL) { + adios(NULL, "unable to create temporary file in %s", + get_temp_dir()); + } ct->c_storage = add (tmpfilenam, NULL); /* Get the folder name */ @@ -607,7 +603,13 @@ store_content (CT ct, CT p) if ((ct->c_storage = clobber_check (add (buffer, NULL))) == NULL) { return NOTOK; } - } /* else output filename was explicitly specified, so use it */ + } else { + /* The output filename was explicitly specified, so use it. */ + if ((ct->c_storage = clobber_check (add (ct->c_storage, NULL))) == + NULL) { + return NOTOK; + } + } got_filename: /* flush the output stream */ @@ -624,7 +626,7 @@ got_filename: */ if (ct->c_folder && (!is_partial || last_partial)) { msgnum = output_content_folder (ct->c_folder, ct->c_storage); - unlink (ct->c_storage); + (void) m_unlink (ct->c_storage); if (msgnum == NOTOK) return NOTOK; }