X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fsend.c;h=2ef1fe765356ea37ed27945b2f4e80c96b68de66;hb=0c4214ea2aec6497d0d67b436bbee9bc1d225f1e;hp=1529c0faa13e16cdf96f6d1fbf6b2abe83a2716b;hpb=f3cb7cde0e6f10451b6848678d95860d512224b9;p=mmh diff --git a/uip/send.c b/uip/send.c index 1529c0f..2ef1fe7 100644 --- a/uip/send.c +++ b/uip/send.c @@ -252,27 +252,17 @@ main(int argc, char **argv) if ((cp = getenv("mhdist")) && *cp && (distsw = atoi(cp)) && altmsg) { vec[vecp++] = "-dist"; - distfile = getcpy(m_mktemp2(altmsg, invo_name, NULL, NULL)); - if (link(altmsg, distfile) == NOTOK) { - if (errno != EXDEV) { - adios(distfile, "unable to link %s to", - altmsg); - } - free(distfile); - distfile = getcpy(m_mktemp2(NULL, invo_name, - NULL, NULL)); - if ((in = open(altmsg, O_RDONLY)) == NOTOK) { - adios(altmsg, "unable to open"); - } - fstat(in, &st2); - if ((out = creat(distfile, (int)st2.st_mode & 0777)) == - NOTOK) { - adios(distfile, "unable to write"); - } - cpydata(in, out, altmsg, distfile); - close(in); - close(out); + if ((in = open(altmsg, O_RDONLY)) == NOTOK) { + adios(altmsg, "unable to open for reading"); } + fstat(in, &st2); + distfile = getcpy(m_mktemp2(NULL, invo_name, NULL, NULL)); + if ((out = creat(distfile, (int)st2.st_mode & 0777))==NOTOK) { + adios(distfile, "unable to open for writing"); + } + cpydata(in, out, altmsg, distfile); + close(in); + close(out); } else { distfile = NULL; } @@ -527,7 +517,6 @@ attach(char *draft_file_name) ** Note that mhbuild is in the context as buildmimeproc. */ sprintf(buf, "%s %s", buildmimeproc, composition_file_name); - if (system(buf) != 0) { /* some problem */ clean_up_temporary_files(); @@ -631,7 +620,7 @@ static int sendaux(char **vec, int vecp, char *drft, struct stat *st) { pid_t child_id; - int i, status, fd; + int status, fd; char backup[BUFSIZ]; /* @@ -646,10 +635,7 @@ sendaux(char **vec, int vecp, char *drft, struct stat *st) } vec[vecp] = NULL; - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) { - sleep(5); - } - switch (child_id) { + switch (child_id = fork()) { case -1: /* oops -- fork error */ adios("fork", "unable to"); @@ -714,14 +700,10 @@ static void alert(char *file, int out) { pid_t child_id; - int i, in; + int in; char buf[BUFSIZ]; - for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) { - sleep(5); - } - - switch (child_id) { + switch (child_id = fork()) { case NOTOK: /* oops -- fork error */ advise("fork", "unable to"); @@ -756,7 +738,6 @@ alert(char *file, int out) /* create subject for error notification */ snprintf(buf, sizeof(buf), "send failed on %s", forwsw ? "enclosed draft" : file); - execlp(mailproc, mhbasename(mailproc), getusername(), "-subject", buf, NULL); fprintf(stderr, "unable to exec ");