X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Freplsbr.c;h=0b0ba6e62de5f966665c7cccc1fced9ced574887;hb=71932c5d0b008eb518d53f9a53978afd35a70ef5;hp=a7616d353f269b4ae25cbde0bd18286c675d34c7;hpb=19b47ea980a98d01112d4bda1d220c7057818ff1;p=mmh diff --git a/uip/replsbr.c b/uip/replsbr.c index a7616d3..0b0ba6e 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -13,6 +13,7 @@ #include #include #include /* L_SET */ +#include extern short ccto; /* from repl.c */ extern short cccc; @@ -247,12 +248,17 @@ finished: * or add mhn directives */ if (filter) { + fflush(out); + if (ferror (out)) + adios (drft, "error writing"); + replfilter (inb, out, filter); } else if (mime && mp) { fprintf (out, "#forw [original message] +%s %s\n", mp->foldpath, m_name (mp->lowsel)); } + fflush(out); if (ferror (out)) adios (drft, "error writing"); fclose (out); @@ -412,6 +418,8 @@ insert (struct mailname *np) /* * Call the mhlproc + * + * This function expects that argument out has been fflushed by the caller. */ static void @@ -419,6 +427,7 @@ replfilter (FILE *in, FILE *out, char *filter) { int pid; char *mhl; + char *errstr; if (filter == NULL) return; @@ -430,7 +439,6 @@ replfilter (FILE *in, FILE *out, char *filter) rewind (in); lseek (fileno(in), (off_t) 0, SEEK_SET); - fflush (out); switch (pid = vfork ()) { case NOTOK: @@ -442,8 +450,12 @@ replfilter (FILE *in, FILE *out, char *filter) closefds (3); execlp (mhlproc, mhl, "-form", filter, "-noclear", NULL); - fprintf (stderr, "unable to exec "); - perror (mhlproc); + errstr = strerror(errno); + write(2, "unable to exec ", 15); + write(2, mhlproc, strlen(mhlproc)); + write(2, ": ", 2); + write(2, errstr, strlen(errstr)); + write(2, "\n", 1); _exit (-1); default: