From: David Levine Date: Tue, 21 Jan 2014 03:08:47 +0000 (-0600) Subject: Replaced use of m_mktemp() with m_mktemp2() so that tmp files created X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/2c5098fd3abe23a163c487f175e84c045d4bd21a?ds=inline;hp=-c Replaced use of m_mktemp() with m_mktemp2() so that tmp files created by attach, burst, mhbuild, and post will be in the directory specified by the first non-null of {MHTMPDIR, TMPDIR, TMP, MH Path directory}. --- 2c5098fd3abe23a163c487f175e84c045d4bd21a diff --git a/uip/attach.c b/uip/attach.c index 29024997..e19a0eba 100644 --- a/uip/attach.c +++ b/uip/attach.c @@ -101,10 +101,10 @@ attach(char *attachment_header_field_name, char *draft_file_name, */ (void)strncpy(body_file_name, - m_mktemp(m_maildir(invo_name), NULL, NULL), + m_mktemp2(NULL, invo_name, NULL, NULL), body_file_name_len); (void)strncpy(composition_file_name, - m_mktemp(m_maildir(invo_name), NULL, NULL), + m_mktemp2(NULL, invo_name, NULL, NULL), composition_file_name_len); if (has_body) diff --git a/uip/burst.c b/uip/burst.c index 34ef10b0..9b893cfe 100644 --- a/uip/burst.c +++ b/uip/burst.c @@ -465,7 +465,7 @@ burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst, i = inplace ? msgnum + numburst : mp->hghmsg; for (j = numburst; j >= (inplace ? 0 : 1); i--, j--) { strncpy (f1, m_name (i), sizeof(f1)); - strncpy (f2, m_mktemp(invo_name, NULL, &out), sizeof(f2)); + strncpy (f2, m_mktemp2(NULL, invo_name, NULL, &out), sizeof(f2)); if (verbosw && i != msgnum) printf ("message %d of digest %d becomes message %d\n", j, msgnum, i); diff --git a/uip/mhbuild.c b/uip/mhbuild.c index 5d527f5c..624cf4b9 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -316,7 +316,7 @@ main (int argc, char **argv) */ if (compfile[0] == '-' && compfile[1] == '\0') { /* copy standard input to temporary file */ - strncpy (infile, m_mktemp(invo_name, NULL, &fp), sizeof(infile)); + strncpy (infile, m_mktemp2(NULL, invo_name, NULL, &fp), sizeof(infile)); while (fgets (buffer, BUFSIZ, stdin)) fputs (buffer, fp); fclose (fp); diff --git a/uip/post.c b/uip/post.c index 85894635..9483dbf6 100644 --- a/uip/post.c +++ b/uip/post.c @@ -535,12 +535,9 @@ main (int argc, char **argv) if ((out = fopen ("/dev/null", "w")) == NULL) adios ("/dev/null", "unable to open"); } else { - char *cp = m_mktemp(m_maildir(invo_name), NULL, &out); + char *cp = m_mktemp2(NULL, invo_name, NULL, &out); if (cp == NULL) { - cp = m_mktemp2(NULL, invo_name, NULL, &out); - if (cp == NULL) { - adios ("post", "unable to create temporary file"); - } + adios ("post", "unable to create temporary file"); } strncpy(tmpfil, cp, sizeof(tmpfil)); chmod (tmpfil, 0600);