]> git.pld-linux.org Git - packages/metamail.git/blob - metamail-tmpfile.patch
970092f245774087e564dba321363e0e205d4603
[packages/metamail.git] / metamail-tmpfile.patch
1 diff -d -r -u -P mm2.7.orig/src/bin/mailserver mm2.7/src/bin/mailserver
2 --- mm2.7.orig/src/bin/mailserver       Mon Jun 15 00:30:47 1998
3 +++ mm2.7/src/bin/mailserver    Mon Jun 15 18:54:01 1998
4 @@ -28,7 +28,15 @@
5  rehash
6  set FromName=""
7  set Subject=""
8 -set TmpFile=/tmp/ms.$$
9 +#  Generate temporary file name:
10 +if ( -x /bin/mktemp ) then
11 +    set TmpFile=`/bin/mktemp /tmp/ms.XXXXXXX` || exit 1
12 +else if ( -x /usr/bin/mktemp ) then
13 +    set TmpFile=`/usr/bin/mktemp /tmp/ms.XXXXXXX` || exit 1
14 +else
15 +    set TmpFile=/tmp/ms.$$
16 +    rm -rf $TmpFile
17 +endif
18  set FOORAW=$<
19  while ("$FOORAW" != "") 
20  set FOO=(` echo "$FOORAW" | tr "[" "x"`)
21 @@ -149,4 +157,5 @@
22  The file: $Subject 
23  was sent to: $FromName
24  !
25 +rm -f $TmpFile
26  exit 0
27 diff -d -r -u -P mm2.7.orig/src/bin/showaudio mm2.7/src/bin/showaudio
28 --- mm2.7.orig/src/bin/showaudio        Mon Jun 15 00:30:47 1998
29 +++ mm2.7/src/bin/showaudio     Mon Jun 15 19:06:25 1998
30 @@ -127,9 +127,18 @@
31      if ($#argv >= 1) then
32         exec /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $*
33      else
34 -       cat > ${METAMAIL_TMPDIR}/audio.$$
35 -       /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end ${METAMAIL_TMPDIR}/audio.$$
36 -       rm ${METAMAIL_TMPDIR}/audio.$$
37 +       # Generate temporary file name:
38 +       if ( -x /bin/mktemp ) then
39 +           set TmpAudio=`/bin/mktemp ${METAMAIL_TMPDIR}/audio.XXXXXXX` || exit 1
40 +       else if ( -x /usr/bin/mktemp ) then
41 +           set TmpAudio=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/audio.XXXXXXX` || exit 1
42 +       else
43 +           set TmpAudio=${METAMAIL_TMPDIR}/audio.$$
44 +           rm -rf $TmpAudio
45 +       endif
46 +       cat > $TmpAudio
47 +       /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $TmpAudio
48 +       rm $TmpAudio
49         exit 0
50      endif
51  else if (-d /usr/sony) then
52 @@ -198,7 +207,15 @@
53  echo ""
54  if (! $?MM_NOTTTY) set MM_NOTTTY=0
55  if ($MM_NOTTTY == 1) then
56 -    set fname=/tmp/mm.aud.$$
57 +    # Generate unique file name:
58 +    if ( -x /bin/mktemp ) then
59 +        set fname=`/bin/mktemp /tmp/mm.aud.XXXXXXX` || exit 1
60 +    else if ( -x /usr/bin/mktemp ) then
61 +        set fname=`/usr/bin/mktemp /tmp/mm.aud.XXXXXXX` || exit 1
62 +    else
63 +        set fname=/tmp/mm.aud.$$
64 +        rm -rf $fname
65 +    endif
66  else
67      echo -n "Do you want to write the audio out to a file [y] ? "
68      set ANS=$<
69 diff -d -r -u -P mm2.7.orig/src/bin/sun-message.csh mm2.7/src/bin/sun-message.csh
70 --- mm2.7.orig/src/bin/sun-message.csh  Mon Jun 15 00:30:47 1998
71 +++ mm2.7/src/bin/sun-message.csh       Mon Jun 15 19:02:09 1998
72 @@ -8,6 +8,10 @@
73  # $2 is untrustworthy data. Quote it.
74  #
75  mkdir /tmp/decode.$$
76 +if ( $? != 0 ) then
77 +    echo "Error: cannot create temporary directory"
78 +    exit 1
79 +endif
80  cd /tmp/decode.$$
81  
82  if (! $?METAMAIL_PAGER) then
83 diff -u -d -r -P mm2.7.orig/src/metamail/splitmail.c mm2.7/src/metamail/splitmail.c
84 --- mm2.7.orig/src/metamail/splitmail.c Sun Jun 14 12:00:20 1998
85 +++ mm2.7/src/metamail/splitmail.c      Sun Jun 14 12:01:09 1998
86 @@ -26,6 +26,7 @@
87  #include <config.h>
88  #include <ctype.h>
89  #include <time.h>
90 +#include <fcntl.h>
91  
92  #define MINCHUNKSIZE 20000 /* Better be enough to hold the headers, or we die! */
93  extern char *malloc(), *index(), *getmyname();
94 @@ -243,6 +244,7 @@
95  char *deliverycmd, *prefix, *SharedHeaders, *SubjectBuf, *id, *MessageID, *bigbuf, *OrigID;
96  {
97      FILE *fpout;
98 +    int fd;
99      char OutputFile[1000];
100      int code;
101  #if defined(sequent)
102 @@ -255,7 +257,10 @@
103          fpout = popen(deliverycmd, "w");
104      } else {
105          sprintf(OutputFile, "%s%d", prefix, whichpart);
106 -        fpout = fopen(OutputFile, "w");
107 +       remove(OutputFile);
108 +       fpout = NULL ;
109 +       fd = open(OutputFile, O_WRONLY|O_CREAT|O_EXCL, 0600);
110 +       if ( fd > -1 ) fpout = fdopen(fd, "w");
111      }
112      if (!fpout) {
113         fprintf(stderr, "splitmail: Can't open %s for writing\n", DoDeliver ? deliverycmd : OutputFile);
114
This page took 0.026804 seconds and 2 git commands to generate.