return ret;
}
+/**
+ * mutt_buffer_mktemp_full - Create a temporary file
+ * @param buf Buffer for result
+ * @param prefix Prefix for filename
+ * @param suffix Suffix for filename
+ * @param src Source file of caller
+ * @param line Source line number of caller
+ */
+void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix,
+ const char *suffix, const char *src, int line)
+{
+ mutt_buffer_printf(buf, "%s/%s-%s-%d-%d-%ld%ld%s%s", NONULL(Tmpdir), NONULL(prefix),
+ NONULL(Hostname), (int) getuid(), (int) getpid(), random(),
+ random(), suffix ? "." : "", NONULL(suffix));
+ mutt_debug(3, "%s:%d: mutt_mktemp returns \"%s\".\n", src, line, mutt_b2s(buf));
+ if (unlink(mutt_b2s(buf)) && errno != ENOENT)
+ {
+ mutt_debug(1, "%s:%d: ERROR: unlink(\"%s\"): %s (errno %d)\n", src, line,
+ mutt_b2s(buf), strerror(errno), errno);
+ }
+}
+
/**
* mutt_mktemp_full - Create a temporary filename
* @param buf Buffer for result
#define MUTT_RANDTAG_LEN 16
void mutt_adv_mktemp(char *s, size_t l);
+void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix, const char *suffix, const char *src, int line);
int mutt_check_overwrite(const char *attname, const char *path, char *fname, size_t flen, int *append, char **directory);
void mutt_encode_path(char *dest, size_t dlen, const char *src);
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, enum FormatFlag flags);
#define mutt_mktemp(a, b) mutt_mktemp_pfx_sfx(a, b, "neomutt", NULL)
#define mutt_mktemp_pfx_sfx(a, b, c, d) mutt_mktemp_full(a, b, c, d, __FILE__, __LINE__)
+#define mutt_buffer_mktemp(a) mutt_buffer_mktemp_pfx_sfx(a, "neomutt", NULL)
+#define mutt_buffer_mktemp_pfx_sfx(a, b, c) mutt_buffer_mktemp_full(a, b, c, __FILE__, __LINE__)
+
#endif /* MUTT_MUTTLIB_H */