int length; /* of attachment header field name */
char *p; /* miscellaneous string pointer */
struct stat st; /* file status buffer */
- FILE *fp; /* pointer for mhn.defaults */
FILE *body_file = NULL; /* body file pointer */
FILE *draft_file; /* draft file pointer */
int field_size; /* size of header field buffer */
* Make names for the temporary files.
*/
- (void)strncpy(body_file_name,
- m_mktemp(m_maildir(invo_name), NULL, NULL),
- body_file_name_len);
- (void)strncpy(composition_file_name,
- m_mktemp(m_maildir(invo_name), NULL, NULL),
- composition_file_name_len);
+ if ((p = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) {
+ adios(NULL, "unable to create temporary file in %s", get_temp_dir());
+ }
+ (void)strncpy(body_file_name, p, body_file_name_len);
+ if ((p = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) {
+ unlink(body_file_name);
+ adios(NULL, "unable to create temporary file in %s", get_temp_dir());
+ }
+ (void)strncpy(composition_file_name, p, composition_file_name_len);
if (has_body)
body_file = fopen(body_file_name, "w");
* composition file for each.
*/
- if ((fp = fopen (p = etcpath ("mhn.defaults"), "r"))) {
- readconfig ((struct node **) NULL, fp, p, 0);
- fclose(fp);
- }
-
rewind(draft_file);
while (get_line(draft_file, field, field_size) != EOF && *field != '\0' &&
char cmd[PATH_MAX + 8]; /* file command buffer */
struct stat st; /* file status buffer */
char *p; /* miscellaneous temporary variables */
- FILE *fp;
int c; /* current character */
if ((content_type = mime_type (file_name)) == NULL) {
* have the suffix in the field, including the dot.
*/
struct node *np; /* context scan node pointer */
+ static FILE *fp = NULL; /* pointer for mhn.defaults */
+
+ if (fp == NULL && (fp = fopen (p = etcpath ("mhn.defaults"), "r"))) {
+ readconfig ((struct node **) NULL, fp, p, 0);
+ fclose(fp);
+ }
if ((p = strrchr(file_name, '.')) != NULL) {
for (np = m_defs; np; np = np->n_next) {
*/
if (content_type == NULL) {
int binary; /* binary character found flag */
+ FILE *fp;
if ((fp = fopen(file_name, "r")) == (FILE *)0) {
advise(NULL, "unable to access file \"%s\"", file_name);
switch (attachformat) {
case 0: {
struct stat st;
+ FILE *fp;
char m[4];
/* Insert name, file mode, and Content-Id. */