X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/86d7837287c4ca1204cca84f55871d862fada47a..a940963381421de5cd0354c6fd1491754b5d1f5c:/uip/mhmail.c diff --git a/uip/mhmail.c b/uip/mhmail.c index f08a583a..e5868609 100644 --- a/uip/mhmail.c +++ b/uip/mhmail.c @@ -2,8 +2,6 @@ /* * mhmail.c -- simple mail program * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. @@ -52,6 +50,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 +124,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);