Use mu_tempname
Showing
3 changed files
with
12 additions
and
11 deletions
... | @@ -222,7 +222,8 @@ message_display_parts (message_t msg, int indent) | ... | @@ -222,7 +222,8 @@ message_display_parts (message_t msg, int indent) |
222 | } | 222 | } |
223 | if ((ret = message_get_header (part, &hdr)) != 0) | 223 | if ((ret = message_get_header (part, &hdr)) != 0) |
224 | { | 224 | { |
225 | fprintf (stderr, "message_get_header - %s\n", mu_errstring (ret)); | 225 | fprintf (stderr, "message_get_header - %s\n", |
226 | mu_errstring (ret)); | ||
226 | exit (2); | 227 | exit (2); |
227 | } | 228 | } |
228 | header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); | 229 | header_get_value (hdr, MU_HEADER_FROM, from, sizeof (from), NULL); |
... | @@ -233,7 +234,8 @@ message_display_parts (message_t msg, int indent) | ... | @@ -233,7 +234,8 @@ message_display_parts (message_t msg, int indent) |
233 | printf ("%*.*sBegin\n", indent, indent, ""); | 234 | printf ("%*.*sBegin\n", indent, indent, ""); |
234 | if ((ret = message_get_num_parts (part, &nsubparts)) != 0) | 235 | if ((ret = message_get_num_parts (part, &nsubparts)) != 0) |
235 | { | 236 | { |
236 | fprintf (stderr, "mime_get_num_parts - %s\n", mu_errstring (ret)); | 237 | fprintf (stderr, "mime_get_num_parts - %s\n", |
238 | mu_errstring (ret)); | ||
237 | exit (2); | 239 | exit (2); |
238 | } | 240 | } |
239 | message_display_parts (part, indent+indent_level); | 241 | message_display_parts (part, indent+indent_level); |
... | @@ -265,11 +267,10 @@ message_display_parts (message_t msg, int indent) | ... | @@ -265,11 +267,10 @@ message_display_parts (message_t msg, int indent) |
265 | char *fname = NULL; | 267 | char *fname = NULL; |
266 | message_aget_attachment_name (part, &fname); | 268 | message_aget_attachment_name (part, &fname); |
267 | if (fname == NULL) | 269 | if (fname == NULL) |
268 | { | 270 | fname = mu_tempname (NULL); |
269 | char buffer[PATH_MAX + 1]; | 271 | |
270 | fname = tempnam (getcwd (buffer, PATH_MAX), "msg-"); | 272 | printf ("%*.*sAttachment - saving [%s]\n", indent, indent, "", |
271 | } | 273 | fname); |
272 | printf ("%*.*sAttachment - saving [%s]\n", indent, indent, "", fname); | ||
273 | printf ("%*.*sBegin\n", indent, indent, ""); | 274 | printf ("%*.*sBegin\n", indent, indent, ""); |
274 | /*FIXME: What is the 'data' argument for? */ | 275 | /*FIXME: What is the 'data' argument for? */ |
275 | message_save_attachment (part, NULL, NULL); | 276 | message_save_attachment (part, NULL, NULL); | ... | ... |
... | @@ -28,9 +28,9 @@ mail_edit (int argc, char **argv) | ... | @@ -28,9 +28,9 @@ mail_edit (int argc, char **argv) |
28 | return util_msglist_command (mail_edit, argc, argv, 1); | 28 | return util_msglist_command (mail_edit, argc, argv, 1); |
29 | else | 29 | else |
30 | { | 30 | { |
31 | char *file = tempnam(getenv("TMPDIR"), "mu"); | 31 | char *file = mu_tempname (NULL); |
32 | util_do_command ("copy %s", file); | 32 | util_do_command ("copy %s", file); |
33 | util_do_command ("shell %s %s", getenv("EDITOR"), file); | 33 | util_do_command ("shell %s %s", getenv ("EDITOR"), file); |
34 | remove (file); | 34 | remove (file); |
35 | free (file); | 35 | free (file); |
36 | return 0; | 36 | return 0; | ... | ... |
... | @@ -30,9 +30,9 @@ mail_visual (int argc, char **argv) | ... | @@ -30,9 +30,9 @@ mail_visual (int argc, char **argv) |
30 | { | 30 | { |
31 | message_t msg = NULL; | 31 | message_t msg = NULL; |
32 | attribute_t attr = NULL; | 32 | attribute_t attr = NULL; |
33 | char *file = tempnam(getenv("TMPDIR"), "mu"); | 33 | char *file = mu_tempname (NULL); |
34 | 34 | ||
35 | util_do_command ("copy %s", file); /* NOTE: copy does not set flags */ | 35 | util_do_command ("copy %s", file); |
36 | util_do_command ("shell %s %s", getenv("VISUAL"), file); | 36 | util_do_command ("shell %s %s", getenv("VISUAL"), file); |
37 | 37 | ||
38 | remove (file); | 38 | remove (file); | ... | ... |
-
Please register or sign in to post a comment