]> diplodocus.org Git - nmh/blobdiff - sbr/m_maildir.c
It does just what it says on the tin.
[nmh] / sbr / m_maildir.c
index 0e8d3f2c2353495a4f0e60facc3be7ff6e3b2207..daf84a7328ca4dde4b4f7eb141c5a461850da4ff 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * m_maildir.c -- get the path for the mail directory
+/* m_maildir.c -- get the path for the mail directory
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -9,6 +7,7 @@
 
 #include <h/mh.h>
 #include <h/utils.h>
+#include "m_maildir.h"
 
 #define        CWD     "./"
 #define        DOT     "."
@@ -23,6 +22,7 @@ static char mailfold[BUFSIZ];
 static char *exmaildir (char *);
 
 
+/* Returns static char[], never NULL. */
 char *
 m_maildir (char *folder)
 {
@@ -37,6 +37,7 @@ m_maildir (char *folder)
 }
 
 
+/* Return value must be free(3)'d. */
 char *
 m_mailpath (char *folder)
 {
@@ -59,6 +60,7 @@ m_mailpath (char *folder)
 }
 
 
+/* Returns static char[], never NULL. */
 static char *
 exmaildir (char *folder)
 {
@@ -85,7 +87,9 @@ exmaildir (char *folder)
        }
        cp = stpcpy(cp, pp);
     } else {
-       cp = stpcpy(cp, path("./", TFOLDER));
+        char *p = path("./", TFOLDER);
+       cp = stpcpy(cp, p);
+        free(p);
     }
     if (cp[-1] != '/')
        *cp++ = '/';