X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/ee04f1033a5dfd6a7949ae644d6c3ed689ad84b8..6bc64765f:/uip/mhbuildsbr.c?ds=sidebyside diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 3cb5f5a6..70747c85 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -42,12 +42,6 @@ extern int contentidsw; extern int rcachesw; /* mhcachesbr.c */ extern int wcachesw; /* mhcachesbr.c */ -/* - * Directory to place tmp files. This must - * be set before these routines are called. - */ -char *tmp; - pid_t xpid = 0; static char prefix[] = "----- =_aaaaaaaaaa"; @@ -129,7 +123,8 @@ static void directive_pop(void) */ CT -build_mime (char *infile, int autobuild, int directives, int header_encoding) +build_mime (char *infile, int autobuild, int dist, int directives, + int header_encoding) { int compnum, state; char buf[BUFSIZ], name[NAMESZ]; @@ -236,7 +231,9 @@ build_mime (char *infile, int autobuild, int directives, int header_encoding) entry = mh_xmalloc(sizeof(*entry)); entry->filename = getcpy(s); + entry->next = NULL; free(vp); + if (attach_tail) { attach_tail->next = entry; attach_tail = entry; @@ -283,9 +280,12 @@ finish_field: * Now add the MIME-Version header field * to the list of header fields. */ - np = add (VRSN_FIELD, NULL); - vp = concat (" ", VRSN_VALUE, "\n", NULL); - add_header (ct, np, vp); + + if (! dist) { + np = add (VRSN_FIELD, NULL); + vp = concat (" ", VRSN_VALUE, "\n", NULL); + add_header (ct, np, vp); + } /* * We initally assume we will find multiple contents in the @@ -461,7 +461,8 @@ finish_field: } /* Build the rest of the header field structures */ - build_headers (ct); + if (! dist) + build_headers (ct); return ct; } @@ -573,8 +574,10 @@ user_content (FILE *in, char *buf, CT *ctp) FILE *out; char *cp; - cp = m_mktemp2(NULL, invo_name, NULL, &out); - if (cp == NULL) adios("mhbuildsbr", "unable to create temporary file"); + if ((cp = m_mktemp2(NULL, invo_name, NULL, &out)) == NULL) { + adios("mhbuildsbr", "unable to create temporary file in %s", + get_temp_dir()); + } /* use a temp file to collect the plain text lines */ ce->ce_file = add (cp, NULL); @@ -1133,10 +1136,10 @@ compose_content (CT ct) if (!(cp = ci->ci_magic)) adios (NULL, "internal error(5)"); - tfile = m_mktemp2(NULL, invo_name, NULL, NULL); - if (tfile == NULL) { - adios("mhbuildsbr", "unable to create temporary file"); - } + if ((tfile = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) { + adios("mhbuildsbr", "unable to create temporary file in %s", + get_temp_dir()); + } ce->ce_file = add (tfile, NULL); ce->ce_unlink = 1;