]> git.pld-linux.org Git - packages/elm.git/blob - elm-tempnam.patch
- move compressed patch to distfiles
[packages/elm.git] / elm-tempnam.patch
1 --- elm2.5.6/src/reply.c.orig   Thu Aug  2 17:24:37 2001
2 +++ elm2.5.6/src/reply.c        Tue Oct 30 04:18:05 2001
3 @@ -43,6 +43,9 @@
4  #include "elm_defs.h"
5  #include "elm_globals.h"
6  #include "s_elm.h"
7 +#include <stdlib.h>
8 +#include <stdio.h>
9 +#include <string.h>
10  
11  /** Note that this routine generates automatic header information
12      for the subject and (obviously) to lines, but that these can
13 @@ -569,9 +572,10 @@
14      FILE *mailfd;
15      char entered[VERY_LONG_STRING], expanded[VERY_LONG_STRING];
16      char *filename, buffer[VERY_LONG_STRING], *msg;
17 -    int  err;
18 -
19 +    int  err,tmpfd;
20 +    char tempfilename[255],*tmpdir;
21      filename = NULL;
22 +    
23      entered[0] = '\0';
24  
25      if (!get_to(entered, expanded, SM_ORIGINAL))
26 @@ -591,7 +595,15 @@
27  /* tempnam is bad.... but only if we open the file in a way that follows
28   * symlinks.... file_open doesn't. */
29     
30 -    if((filename = tempnam(temp_dir, "snd.")) == NULL) {
31 +    tmpdir=getenv("TMPDIR");
32 +    if(tmpdir!=NULL){
33 +        snprintf(tempfilename,255,"%s/snd.XXXXXX",tmpdir);
34 +    }
35 +    else{
36 +        strncpy(tempfilename,"/tmp/snd.XXXXXX",254);
37 +    }
38 +
39 +    if((tmpfd = mkstemp(tempfilename)) == -1) {
40         dprint(1, (debugfile, "couldn't make temp file nam! (remail)\n"));
41         set_error(catgets(elm_msg_cat, ElmSet, ElmCouldntMakeTempFileName,
42                     "Sorry - couldn't make file temp file name."));
43 --- elm2.5.5/src/sndpart_io.c.tempnam   Thu Apr  6 16:01:21 2000
44 +++ elm2.5.5/src/sndpart_io.c   Mon Jun 11 15:00:46 2001
45 @@ -28,6 +28,9 @@
46  #include "sndparts.h"
47  #include "s_elm.h"
48  #include <assert.h>
49 +#include <string.h>
50 +#include <stdlib.h>
51 +#include <stdio.h>
52  
53  static int multipart_seqnum;
54  
55 @@ -517,14 +520,24 @@
56      char *fname_tmp, *fname_sel, cmd_buf[SLEN], *s;
57      int rc, i;
58      FILE *fp_src;
59 -
60 +    char *tmpdir;
61 +    
62      rc = -1;
63      fp_src = NULL;
64  
65 +    tmpdir=getenv("TMPDIR");
66 +    if(!tmpdir){
67 +        tmpdir=alloca(25);
68 +        strcpy(tmpdir,"/tmp");
69 +    }
70 +        
71 +    fname_tmp=(char*)calloc(300,sizeof(char));
72 +    snprintf(fname_tmp,299,"%s/emm.XXXXXX",tmpdir);
73      switch (mime_encoding_type(part->content_header[BP_CONT_ENCODING])) {
74 +        
75  
76      case ENCODING_QUOTED:
77 -       if ((fname_tmp = tempnam(temp_dir, "emm.")) == NULL) {
78 +        if((mkstemp(fname_tmp))==-1){
79             error("Cannot make temp file name.");
80             return -1;
81         }
82 @@ -532,7 +545,7 @@
83         break;
84  
85      case ENCODING_BASE64:
86 -       if ((fname_tmp = tempnam(temp_dir, "emm.")) == NULL) {
87 +        if((mkstemp(fname_tmp))==-1){
88             error("Cannot make temp file name.");
89             return -1;
90         }
91 @@ -540,7 +553,7 @@
92         break;
93  
94      case ENCODING_UUENCODE:
95 -       if ((fname_tmp = tempnam(temp_dir, "emm.")) == NULL) {
96 +        if((mkstemp(fname_tmp))==-1){
97             error("Cannot make temp file name.");
98             return -1;
99         }
100 @@ -549,6 +562,7 @@
101  
102      default:
103         /* encoding not needed */
104 +        free(fname_tmp);
105         fname_tmp = NULL;
106         break;
107      }
108 --- elm2.5.5/src/sndmsg.c.tempnam       Thu Apr  6 16:19:55 2000
109 +++ elm2.5.5/src/sndmsg.c       Mon Jun 11 15:00:46 2001
110 @@ -40,6 +40,9 @@
111  #include "sndparts.h"
112  #include "s_elm.h"
113  #include <assert.h>
114 +#include <string.h>
115 +#include <stdio.h>
116 +#include <stdlib.h>
117  
118  extern char *bounce_off_remote();
119  extern char *strip_commas();
120 @@ -80,8 +83,8 @@
121      char bigbuf[VERY_LONG_STRING];
122      char *s;
123      int i;
124 -
125 -    /* is there a cancelled message laying around from last time? */
126 +    char *tmpdir;
127 +/* is there a cancelled message laying around from last time? */
128      static int cancelled_msg = FALSE;
129      static int saved_want_sig = FALSE;
130  
131 @@ -98,6 +101,12 @@
132      send_attempts = 0;
133      rc = -1;
134  
135 +    tmpdir=getenv("TMPDIR");
136 +    if(!tmpdir){
137 +        tmpdir=alloca(6);
138 +        strcpy(tmpdir,"/tmp");
139 +    }
140 +    
141      assert(mssgtype == SM_ORIGINAL || OPMODE_IS_READMODE(opmode));
142      switch (mssgtype) {
143      case SM_ORIGINAL:
144 @@ -359,7 +368,12 @@
145      remove_hostbang(shdr->expanded_bcc);
146  
147      /* create temp file in which to build entire message */
148 -    if ((fname_fullmssg = tempnam(temp_dir, "xmt.")) == NULL) {
149 +    if(fname_fullmssg)
150 +        free(fname_fullmssg);
151 +    fname_fullmssg=calloc(300,sizeof(char));
152 +    snprintf(fname_fullmssg,299,"%s/xmt.XXXXXX",tmpdir);
153 +
154 +    if (mkstemp(fname_fullmssg)==-1){
155         dprint(1, (debugfile, "couldn't make temp file nam! (mail)\n"));
156         error(catgets(elm_msg_cat, ElmSet, ElmCouldNotMakeTemp,
157                 "Sorry - couldn't make temp file name."));
158 --- elm2.5.5/src/sndpart_lib.c.tempnam  Thu Mar 14 12:29:56 1996
159 +++ elm2.5.5/src/sndpart_lib.c  Mon Jun 11 15:00:56 2001
160 @@ -4,7 +4,9 @@
161  #include "sndparts.h"
162  #include "s_elm.h"
163  #include <assert.h>
164 -
165 +#include <string.h>
166 +#include <stdio.h>
167 +#include <stdlib.h>
168  
169  /*******************/
170  /* Part is parts!! */
171 @@ -239,6 +241,14 @@
172      int len;
173      FILE *fp;
174      float p;
175 +    char *tmpdir;
176 +    
177 +
178 +    tmpdir=getenv("TMPDIR");
179 +    if(!tmpdir){
180 +        tmpdir=alloca(6);
181 +        strcpy(tmpdir,"/tmp");
182 +    }
183  
184      assert(sel >= 0 && sel < BP_NUM_CONT_HEADERS);
185      bodypart_integrity_check(part);
186 @@ -289,8 +299,12 @@
187  
188      case BP_CONT_DESCRIPTION:
189         value = NULL;
190 -       if ((fname_tmp = tempnam(temp_dir, "fil.")) != NULL) {
191 -           MIME_FILE_CMD(buf, part->fname, fname_tmp);
192 +        if(fname_tmp)
193 +            free(fname_tmp);
194 +        fname_tmp=calloc(300,sizeof(char));
195 +        snprintf(fname_tmp,299,"%s/file.XXXXXX",tmpdir);
196 +        if(mkstemp(fname_tmp)!=-1){
197 +           MIME_FILE_CMD(buf, part->fname, fname_tmp);
198             if (system_call(buf, 0) == 0) {
199                 if ((fp = fopen(fname_tmp, "r")) != NULL) {
200                     if (fgets(buf, sizeof(buf), fp) != NULL) {
This page took 0.072437 seconds and 3 git commands to generate.