From a404a36988ef8eb4b640bdd1d3f30298e0ca5182 Mon Sep 17 00:00:00 2001 From: David Levine Date: Thu, 23 Jan 2014 22:16:34 -0600 Subject: [PATCH] Replaced use of mkstemp() with m_mktemp2() in header_fd() of rcvtty.c. It never would have worked, anyway, because it had 5 instead of 6 X's in the template. --- uip/rcvtty.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 760d22dc..9dd862c7 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -189,13 +189,14 @@ message_fd (char **vec) { pid_t child_id; int bytes, seconds; - /* volatile to prevent "might be clobbered" warning from gcc: */ - volatile int fd; - char tmpfil[BUFSIZ]; + int fd; + char *tfile; struct stat st; - fd = mkstemp (strncpy (tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil))); - unlink (tmpfil); + if ((tfile = m_mktemp2(NULL, invo_name, &fd, NULL)) == NULL) { + advise(NULL, "unable to create temporary file in %s", get_temp_dir()); + return NOTOK; + } if ((child_id = fork()) == NOTOK) { /* fork error */ @@ -259,7 +260,6 @@ header_fd (void) advise(NULL, "unable to create temporary file in %s", get_temp_dir()); return NOTOK; } - unlink (tfile); rewind (stdin); -- 2.56.0