#ifdef OAUTH_SUPPORT
#include <h/oauth.h>
#endif
-#include "../sbr/m_maildir.h"
-#include "../sbr/m_mktemp.h"
-#include "../sbr/message_id.h"
+#include "h/done.h"
+#include "sbr/m_maildir.h"
+#include "sbr/m_mktemp.h"
+#include "sbr/message_id.h"
#ifdef OAUTH_SUPPORT
static int setup_oauth_params(char *[], int *, const char *, const char **);
execvp(buildprogram, buildvec);
fprintf(stderr, "unable to exec ");
perror(buildmimeproc);
- _exit(-1);
+ _exit(1);
break;
default:
break;
}
- done=armed_done;
+ set_done(armed_done);
switch (setjmp (env)) {
case OK:
/*
if (pushsw && unique) {
char *cp = m_mktemp2(drft, invo_name, NULL, NULL);
if (cp == NULL) {
- adios(NULL, "unable to create temporary file in %s",
- get_temp_dir());
+ die("unable to create temporary file");
}
if (rename (drft, strncpy(file, cp, sizeof(file))) == NOTOK)
adios (file, "unable to rename %s to", drft);
#ifdef OAUTH_SUPPORT
const char *errmsg;
if (setup_oauth_params(vec, nvecsp, auth_svc, &errmsg) != OK) {
- adios(NULL, "%s", errmsg);
+ die("%s", errmsg);
}
#else
- adios(NULL, "send built without OAUTH_SUPPORT, "
+ die("send built without OAUTH_SUPPORT, "
"so auth_svc %s is not supported", auth_svc);
#endif /* OAUTH_SUPPORT */
}
break;
}
- done=exit;
+ set_done(exit);
if (distfile)
(void) m_unlink (distfile);
case LENERR:
case FMTERR:
- adios (NULL, "message format error in component #%d", compnum);
+ die("message format error in component #%d", compnum);
default:
- adios (NULL, "getfld () returned %d", state);
+ die("getfld () returned %d", state);
}
break;
}
m_getfld_state_destroy (&gstate);
if (cp == NULL)
- adios (NULL, "headers missing from draft");
+ die("headers missing from draft");
nparts = 1;
pos = start;
/* Only one part, nothing to split */
if (nparts == 1) {
free (cp);
- mh_xfree(dp);
+ free(dp);
fclose (in);
return sendaux (vec, vecp, program, drft, st);
char *cp = m_mktemp2(drft, invo_name, NULL, &out);
if (cp == NULL) {
- adios(NULL, "unable to create temporary file in %s",
- get_temp_dir());
+ die("unable to create temporary file");
}
strncpy(tmpdrf, cp, sizeof(tmpdrf));
if (!fgets (buffer, sizeof buffer, in)) {
if (partno == nparts)
break;
- adios (NULL, "premature eof");
+ die("premature eof");
}
if ((pos += (len = strlen (buffer))) > CPERMSG) {
}
free (cp);
- mh_xfree(dp);
+ free(dp);
fclose (in); /* close the draft */
return status;
sendaux (char **vec, int vecp, char *program, char *drft, struct stat *st)
{
pid_t child_id;
- int i, status, fd, fd2;
+ int status, fd, fd2;
char backup[BUFSIZ], buf[BUFSIZ];
fd = pushsw ? tmp_fd () : NOTOK;
done (1);
vec[vecp] = NULL;
- for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
- sleep (5);
-
+ child_id = fork();
switch (child_id) {
case -1:
/* oops -- fork error */
execvp (program, vec);
fprintf (stderr, "unable to exec ");
perror (postproc);
- _exit (-1);
+ _exit(1);
default:
/*
alert (char *file, int out)
{
pid_t child_id;
- int i, in, argp;
+ int in, argp;
char buf[BUFSIZ];
char *program;
char **arglist;
- for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
- sleep (5);
-
+ child_id = fork();
switch (child_id) {
case NOTOK:
/* oops -- fork error */
execvp (program, arglist);
fprintf (stderr, "unable to exec ");
perror (mailproc);
- _exit (-1);
+ _exit(1);
default: /* no waiting... */
break;
if (strcmp(*vp, "xoauth2") == 0) {
#ifdef OAUTH_SUPPORT
if (setup_oauth_params(vec, vecp, auth_svc, &message) != OK) {
- adios(NULL, "%s", message);
+ die("%s", message);
}
break;
#else
NMH_UNUSED(auth_svc);
- adios(NULL, "send built without OAUTH_SUPPORT, "
+ die("send built without OAUTH_SUPPORT, "
"so -saslmech xoauth2 is not supported");
#endif /* OAUTH_SUPPORT */
}
if (saslmech && ! strcasecmp(saslmech, "xoauth2")) {
if (! mh_oauth_get_service_info(auth_svc, &svc, errbuf,
sizeof(errbuf)))
- adios(NULL, "Unable to retrieve oauth profile entries: %s",
+ die("Unable to retrieve oauth profile entries: %s",
errbuf);
vec[(*vecp)++] = mh_xstrdup("-authservice");
vec[(*vecp)++] = mh_xstrdup(auth_svc);
vec[(*vecp)++] = mh_xstrdup("-oauthcredfile");
- vec[(*vecp)++] = mh_xstrdup(mh_oauth_cred_fn(auth_svc));
+ vec[(*vecp)++] = mh_oauth_cred_fn(auth_svc);
vec[(*vecp)++] = mh_xstrdup("-oauthclientid");
vec[(*vecp)++] = getcpy(svc.client_id);
vec[(*vecp)++] = mh_xstrdup("-oauthclientsecret");