]> diplodocus.org Git - nmh/commitdiff
Replaced use of m_mktemp() with m_mktemp2() so that tmp files created
authorDavid Levine <levinedl@acm.org>
Tue, 21 Jan 2014 03:08:47 +0000 (21:08 -0600)
committerDavid Levine <levinedl@acm.org>
Tue, 21 Jan 2014 03:08:47 +0000 (21:08 -0600)
by attach, burst, mhbuild, and post will be in the directory specified
by the first non-null of {MHTMPDIR, TMPDIR, TMP, MH Path directory}.

uip/attach.c
uip/burst.c
uip/mhbuild.c
uip/post.c

index 2902499..e19a0eb 100644 (file)
@@ -101,10 +101,10 @@ attach(char *attachment_header_field_name, char *draft_file_name,
      */
 
     (void)strncpy(body_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,
                   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)
                   composition_file_name_len);
 
     if (has_body)
index 34ef10b..9b893cf 100644 (file)
@@ -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));
     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);
 
        if (verbosw && i != msgnum)
            printf ("message %d of digest %d becomes message %d\n", j, msgnum, i);
index 5d527f5..624cf4b 100644 (file)
@@ -316,7 +316,7 @@ main (int argc, char **argv)
      */
     if (compfile[0] == '-' && compfile[1] == '\0') {
        /* copy standard input to temporary file */
      */
     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);
        while (fgets (buffer, BUFSIZ, stdin))
            fputs (buffer, fp);
        fclose (fp);
index 8589463..9483dbf 100644 (file)
@@ -535,12 +535,9 @@ main (int argc, char **argv)
            if ((out = fopen ("/dev/null", "w")) == NULL)
                adios ("/dev/null", "unable to open");
        } else {
            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) {
             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);
             }
             strncpy(tmpfil, cp, sizeof(tmpfil));
            chmod (tmpfil, 0600);