Commit f6d9a980 authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Add mutt_buffer_mktemp() transition function.

This is self-contained and easy to translate, so instead just create
an alternate implementation using BUFFER.
parent 4781461c
......@@ -799,6 +799,19 @@ void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra)
void _mutt_buffer_mktemp (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 (Tempdir), NONULL (prefix), NONULL (Hostname),
(int) getuid (), (int) getpid (), random (), random (),
suffix ? "." : "", NONULL (suffix));
dprint (3, (debugfile, "%s:%d: mutt_mktemp returns \"%s\".\n", src, line, mutt_b2s (buf)));
if (unlink (mutt_b2s (buf)) && errno != ENOENT)
dprint (1, (debugfile, "%s:%d: ERROR: unlink(\"%s\"): %s (errno %d)\n",
src, line, mutt_b2s (buf), strerror (errno), errno));
void _mutt_mktemp (char *s, size_t slen, const char *prefix, const char *suffix,
const char *src, int line)
......@@ -229,6 +229,9 @@ void mutt_make_misc_reply_headers (ENVELOPE *env, CONTEXT *ctx, HEADER *cur, ENV
void mutt_make_post_indent (CONTEXT *ctx, HEADER *cur, FILE *out);
void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra);
void mutt_message_to_7bit (BODY *, FILE *);
#define mutt_buffer_mktemp(a) mutt_buffer_mktemp_pfx_sfx (a, "mutt", NULL)
#define mutt_buffer_mktemp_pfx_sfx(a,b,c) _mutt_buffer_mktemp (a, b, c, __FILE__, __LINE__)
void _mutt_buffer_mktemp (BUFFER *, const char *, const char *, const char *, int);
#define mutt_mktemp(a,b) mutt_mktemp_pfx_sfx (a, b, "mutt", NULL)
#define mutt_mktemp_pfx_sfx(a,b,c,d) _mutt_mktemp (a, b, c, d, __FILE__, __LINE__)
void _mutt_mktemp (char *, size_t, const char *, const char *, const char *, int);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment