Commit d52428a2 d52428a2bbad0e0f80b5c35c2ea90c3af2e7d51b by Sergey Poznyakoff

(lazy_create): Removed. Use mu_tempname() instead.

1 parent 9ddac665
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
34 34
35 #define BODY_MODIFIED 0x10000 35 #define BODY_MODIFIED 0x10000
36 36
37 static int lazy_create __P ((body_t));
38 static int _body_flush __P ((stream_t)); 37 static int _body_flush __P ((stream_t));
39 static int _body_get_fd __P ((stream_t, int *)); 38 static int _body_get_fd __P ((stream_t, int *));
40 static int _body_read __P ((stream_t, char *, size_t, off_t, size_t *)); 39 static int _body_read __P ((stream_t, char *, size_t, off_t, size_t *));
...@@ -147,19 +146,16 @@ body_get_stream (body_t body, stream_t *pstream) ...@@ -147,19 +146,16 @@ body_get_stream (body_t body, stream_t *pstream)
147 146
148 if (body->stream == NULL) 147 if (body->stream == NULL)
149 { 148 {
150 int fd;
151 int status = stream_create (&body->stream, MU_STREAM_RDWR, body); 149 int status = stream_create (&body->stream, MU_STREAM_RDWR, body);
152 if (status != 0) 150 if (status != 0)
153 return status; 151 return status;
154 /* Create the temporary file. */ 152 /* Create the temporary file. */
155 fd = lazy_create (body); 153 body->filename = mu_tempname (NULL);
156 if (fd == -1) 154 status = file_stream_create (&body->fstream,
157 return errno; 155 body->filename, MU_STREAM_RDWR);
158 status = file_stream_create (&body->fstream, body->filename, MU_STREAM_RDWR);
159 if (status != 0) 156 if (status != 0)
160 return status; 157 return status;
161 status = stream_open (body->fstream); 158 status = stream_open (body->fstream);
162 close (fd);
163 if (status != 0) 159 if (status != 0)
164 return status; 160 return status;
165 stream_set_fd (body->stream, _body_get_fd, body); 161 stream_set_fd (body->stream, _body_get_fd, body);
...@@ -340,10 +336,6 @@ _body_get_lines0 (stream_t stream, size_t *plines) ...@@ -340,10 +336,6 @@ _body_get_lines0 (stream_t stream, size_t *plines)
340 return status; 336 return status;
341 } 337 }
342 338
343 #ifndef P_tmpdir
344 # define P_tmpdir "/tmp"
345 #endif
346
347 static int 339 static int
348 lazy_create (body_t body) 340 lazy_create (body_t body)
349 { 341 {
......