]> diplodocus.org Git - nmh/blobdiff - sbr/m_mktemp.c
new.c: Order two return statements to match comment.
[nmh] / sbr / m_mktemp.c
index 6bfa705f405f1d3e7b987e3a834b3420a43166ef..d4b8fde05154d28b954463c115697cfb62203339 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * m_mktemp.c -- Construct a temporary file.
+/* m_mktemp.c -- Construct a temporary file.
  *
  * This code is Copyright (c) 2010, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -9,6 +8,8 @@
 #include <h/mh.h>
 #include <h/utils.h>
 #include <h/signals.h>
+#include "m_maildir.h"
+#include "m_mktemp.h"
 
 static void register_for_removal(const char *);
 
@@ -155,10 +156,9 @@ m_mktemps(
 
     if (suffix == NULL) {
         if ((tmpfil = m_mktemp2(NULL, pfx_in, fd_ret, fp_ret))) {
-            return add(tmpfil, NULL);
-        } else {
-            return NULL;
+            return mh_xstrdup(tmpfil);
         }
+        return NULL;
     }
 
 #if HAVE_MKSTEMPS
@@ -230,7 +230,7 @@ m_mktemps(
 
 
 char *
-get_temp_dir()
+get_temp_dir(void)
 {
     /* Ignore envvars if we are setuid */
     if ((getuid()==geteuid()) && (getgid()==getegid())) {
@@ -258,7 +258,7 @@ static svector_t exit_filelist = NULL;
 static void
 register_for_removal(const char *pathname) {
     if (exit_filelist == NULL) exit_filelist = svector_create(20);
-    (void) svector_push_back(exit_filelist, add(pathname, NULL));
+    (void) svector_push_back(exit_filelist, mh_xstrdup(pathname));
 }
 
 /*
@@ -321,7 +321,7 @@ m_unlink(const char *pathname) {
  * Remove all registered temporary files.
  */
 void
-remove_registered_files_atexit() {
+remove_registered_files_atexit(void) {
     unregister_for_removal(1);
 }