- strncpy (tmpfil, m_tmpfil (invo_name), sizeof(tmpfil));
- if ((fp = fopen (tmpfil, "w+")) == NULL)
- adios (tmpfil, "unable to open for writing");
- chmod (tmpfil, 0600);
+ tfile = m_mktemp2(NULL, invo_name, NULL, &fp);
+ if (tfile == NULL) adios("viamail", "unable to create temporary file");
+ chmod(tfile, 0600);
+ strncpy (tmpfil, tfile, sizeof(tmpfil));