mutt stable branch with some hacks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

use a 64-bit random value in temporary filenames.

closes #3158

+23 -2
+16
init.c
··· 50 50 #include <sys/utsname.h> 51 51 #include <errno.h> 52 52 #include <sys/wait.h> 53 + #include <sys/time.h> 53 54 54 55 #define CHECK_PAGER \ 55 56 if ((CurrentMenu == MENU_PAGER) && (idx >= 0) && \ ··· 2858 2859 return 0; 2859 2860 } 2860 2861 2862 + static void mutt_srandom (void) 2863 + { 2864 + struct timeval tv; 2865 + unsigned seed; 2866 + 2867 + gettimeofday(&tv, NULL); 2868 + /* POSIX.1-2008 states that seed is 'unsigned' without specifying its width. 2869 + * Use as many of the lower order bits from the current time of day as the seed. 2870 + * If the upper bound is truncated, that is fine. 2871 + */ 2872 + seed = (tv.tv_sec << 20) | tv.tv_usec; 2873 + srandom(seed); 2874 + } 2875 + 2861 2876 void mutt_init (int skip_sys_rc, LIST *commands) 2862 2877 { 2863 2878 struct passwd *pw; ··· 2874 2889 ReverseAlias = hash_create (1031, 1); 2875 2890 2876 2891 mutt_menu_init (); 2892 + mutt_srandom (); 2877 2893 2878 2894 /* 2879 2895 * XXX - use something even more difficult to predict?
+7 -2
muttlib.c
··· 781 781 782 782 void _mutt_mktemp (char *s, size_t slen, const char *src, int line) 783 783 { 784 - snprintf (s, slen, "%s/mutt-%s-%d-%d-%d", NONULL (Tempdir), NONULL(Hostname), (int) getuid(), (int) getpid (), Counter++); 784 + size_t n = snprintf (s, slen, "%s/mutt-%s-%d-%d-%ld%ld", NONULL(Tempdir), NONULL(Hostname), 785 + (int) getuid(), (int) getpid(), random(), random()); 786 + if (n >= slen) 787 + dprint(1, (debugfile, "%s:%d: ERROR: insufficient buffer space to hold temporary filename! slen=%zu but need %zu\n", 788 + src, line, slen, n)); 785 789 dprint (3, (debugfile, "%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s)); 786 - unlink (s); 790 + if (unlink (s)) 791 + dprint(1, (debugfile, "%s:%d: ERROR: unable to unlink temporary file\n", src, line)); 787 792 } 788 793 789 794 void mutt_free_alias (ALIAS **p)