X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhmail.c;h=e906b1d3c928d0e9031e37692d222f18df0b1f04;hb=bd7d13ad3cdf433d73849b3bb847eaec2f1396ba;hp=b5da86c6f583301e27091cd7afda8893ca9d0ee6;hpb=9a33ff618b5901a3af815650d4b84d39ee96e529;p=mmh diff --git a/uip/mhmail.c b/uip/mhmail.c index b5da86c..e906b1d 100644 --- a/uip/mhmail.c +++ b/uip/mhmail.c @@ -52,6 +52,7 @@ main (int argc, char **argv) char *from = NULL, *body = NULL, **argp, **arguments; char *vec[5], buf[BUFSIZ]; FILE *out; + char *tfile = NULL; #ifdef LOCALE setlocale(LC_ALL, ""); @@ -125,10 +126,11 @@ main (int argc, char **argv) if (tolist == NULL) adios (NULL, "usage: %s addrs ... [switches]", invo_name); - strncpy (tmpfil, m_tmpfil (invo_name), sizeof(tmpfil)); - if ((out = fopen (tmpfil, "w")) == NULL) - adios (tmpfil, "unable to write"); - chmod (tmpfil, 0600); + + tfile = m_mktemp2(NULL, invo_name, NULL, &out); + if (tfile == NULL) adios("mhmail", "unable to create temporary file"); + chmod(tfile, 0600); + strncpy (tmpfil, tfile, sizeof(tmpfil)); SIGNAL2 (SIGINT, intrser); @@ -173,7 +175,7 @@ main (int argc, char **argv) if (child_id == NOTOK) { /* report failure and then send it */ - admonish (NULL, "unable to fork"); + adios (NULL, "unable to fork"); } else if (child_id) { /* parent process */ if ((status = pidXwait(child_id, postproc))) {