From c267220c147445266cdb9fb20e7e2c22957138f3 Mon Sep 17 00:00:00 2001 From: Lyndon Nerenberg Date: Sun, 25 Dec 2011 11:58:38 -0800 Subject: [PATCH] Make use of mkstemp() unconditional (vs. mktemp(). This patch also removes the m_scratch() and m_tmpfil() functions. They have been deprecated for a while, and are no longer used in any of the code base. --- sbr/m_scratch.c | 41 ----------------------------------------- sbr/m_tmpfil.c | 32 -------------------------------- 2 files changed, 73 deletions(-) delete mode 100644 sbr/m_scratch.c delete mode 100644 sbr/m_tmpfil.c diff --git a/sbr/m_scratch.c b/sbr/m_scratch.c deleted file mode 100644 index 3c63d09..0000000 --- a/sbr/m_scratch.c +++ /dev/null @@ -1,41 +0,0 @@ - -/* - * m_scratch.c -- construct a scratch file - * - * 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. - */ - -#include - -/*************************************************************************** - * DO NOT USE THIS FUNCTION! IT WILL BE REMOVED IN THE FUTURE. - * THIS FUNCTION IS INSECURE. USE THE FUNCTIONS DEFINED IN m_mktemp.c. - ***************************************************************************/ -char * -m_scratch (char *file, char *template) -{ - char *cp; - static char buffer[BUFSIZ], tmpfil[BUFSIZ]; - - snprintf (tmpfil, sizeof(tmpfil), "%sXXXXXX", template); -/* - Mkstemp work postponed until later -Doug -#ifdef HAVE_MKSTEMP - mkstemp (tmpfil); -#else -*/ - mktemp (tmpfil); -/* -#endif -*/ - /* nasty - this really means: if there is no '/' in the path */ - if ((cp = r1bindex (file, '/')) == file) - strncpy (buffer, tmpfil, sizeof(buffer)); - else - snprintf (buffer, sizeof(buffer), "%.*s%s", (int)(cp - file), file, tmpfil); - unlink (buffer); - - return buffer; -} diff --git a/sbr/m_tmpfil.c b/sbr/m_tmpfil.c deleted file mode 100644 index 291d996..0000000 --- a/sbr/m_tmpfil.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * m_tmpfil.c -- construct a temporary file - * - * 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. - */ - -#include - -/*************************************************************************** - * DO NOT USE THIS FUNCTION! IT WILL BE REMOVED IN THE FUTURE. - * THIS FUNCTION IS INSECURE. USE THE FUNCTIONS DEFINED IN m_mktemp.c. - ***************************************************************************/ -char * -m_tmpfil (char *template) -{ - static char tmpfil[BUFSIZ]; - - snprintf (tmpfil, sizeof(tmpfil), "/tmp/%sXXXXXX", template); -/* - Mkstemp work postponed until later -Doug -#ifdef HAVE_MKSTEMP - unlink(mkstemp(tmpfil)); -#else -*/ - unlink(mktemp(tmpfil)); -/* -#endif -*/ - return tmpfil; -} -- 1.7.10.4