summaryrefslogtreecommitdiff
path: root/mail/mutt/files/patch-mktemp
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mutt/files/patch-mktemp')
-rw-r--r--mail/mutt/files/patch-mktemp30
1 files changed, 19 insertions, 11 deletions
diff --git a/mail/mutt/files/patch-mktemp b/mail/mutt/files/patch-mktemp
index 8fc82de528d7..16521f758607 100644
--- a/mail/mutt/files/patch-mktemp
+++ b/mail/mutt/files/patch-mktemp
@@ -1,15 +1,23 @@
---- muttlib.c.orig Fri May 7 17:30:35 2004
-+++ muttlib.c Fri May 7 17:32:13 2004
-@@ -656,7 +656,11 @@
+--- muttlib.c.orig 2010-09-19 09:58:24.000000000 +0200
++++ muttlib.c 2010-09-19 10:36:26.000000000 +0200
+@@ -788,14 +788,15 @@
- void mutt_mktemp (char *s)
+ void _mutt_mktemp (char *s, size_t slen, const char *src, int line)
{
-- snprintf (s, _POSIX_PATH_MAX, "%s/mutt-%s-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getpid (), Counter++);
-+ char t[7];
-+ snprintf (t, 7, "-%05d", Counter++);
-+ snprintf (s, _POSIX_PATH_MAX-6, "%s/mutt-%s-XXXXXXXX", NONULL(Tempdir), NONULL(Hostname));
-+ mktemp (s);
-+ strncat(s, t, 6);
- unlink (s);
+- size_t n = snprintf (s, slen, "%s/mutt-%s-%d-%d-%ld%ld", NONULL (Tempdir), NONULL (Hostname),
+- (int) getuid (), (int) getpid (), random (), random ());
++ size_t n = snprintf (s, slen, "%s/mutt-%s-XXXXXXXX", NONULL (Tempdir), NONULL (Hostname));
+ if (n >= slen)
+ dprint (1, (debugfile, "%s:%d: ERROR: insufficient buffer space to hold temporary filename! slen=%zu but need %zu\n",
+ src, line, slen, n));
+- dprint (3, (debugfile, "%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s));
+- if (unlink (s) && errno != ENOENT)
+- dprint (1, (debugfile, "%s:%d: ERROR: unlink(\"%s\"): %s (errno %d)\n", src, line, s, strerror (errno), errno));
++ if (mktemp (s)) {
++ dprint (3, (debugfile, "%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s));
++ } else {
++ dprint (1, (debugfile, "%s:%d: ERROR: mktemp(\"%s\"): %s (errno %d)\n", src, line, s, strerror (errno), errno));
++ }
}
+ void mutt_free_alias (ALIAS **p)