# header files included in distribution
HDRS = addrsbr.h aliasbr.h crawl_folders.h dropsbr.h fmt_compile.h fmt_scan.h \
md5.h mf.h mh.h mhcachesbr.h mhparse.h mime.h msh.h mts.h \
- nmh.h picksbr.h popsbr.h prototypes.h rcvmail.h \
+ m_setjmp.h nmh.h picksbr.h popsbr.h prototypes.h rcvmail.h \
scansbr.h signals.h tws.h vmhsbr.h utils.h
# auxiliary files
--- /dev/null
+
+/*
+ * m_setjmp.h -- Wraps setjmp() and sigsetjmp(), to help prevent warnings
+ * -- about arguments and variables that might be clobbered by
+ * -- a setjmp call with gcc -Wclobbered.
+ *
+ * This code is Copyright (c) 2012, by the authors of nmh. See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
+ */
+
+#include <setjmp.h>
+
+int m_setjmp(jmp_buf);
+
+int m_sigsetjmp(sigjmp_buf, int);
char *m_mktemp(const char *, int *, FILE **);
char *m_mktemp2(const char *, const char *, int *, FILE **);
void m_unknown(FILE *);
+pid_t m_vfork ();
int makedir (char *);
char *nmh_getpass(const char *);
char *norm_charmap(char *);
#if defined(SMTPMTS)
# include <ctype.h>
# include <errno.h>
-# include <setjmp.h>
# include <stdio.h>
# include <sys/types.h>
# include <mts/smtp/smtp.h>
fmt_addr.c fmt_compile.c fmt_new.c fmt_rfc2047.c \
fmt_scan.c lock_file.c m_atoi.c m_backup.c \
m_convert.c m_draft.c m_getfld.c m_gmprot.c \
- m_maildir.c m_name.c \
+ m_maildir.c m_name.c m_setjmp.c m_vfork.c \
makedir.c mts.c norm_charmap.c \
path.c peekc.c pidwait.c pidstatus.c \
print_help.c print_sw.c print_version.c push.c \
if ((hook = context_find(hook_name)) == (char *)0)
return (OK);
- switch (pid = vfork()) {
+ switch (pid = m_vfork()) {
case -1:
status = NOTOK;
advise(NULL, "external database may be out-of-date.");
fflush (stdout);
vec[0] = r1bindex (rmmproc, '/');
- switch (pid = vfork()) {
+ switch (pid = m_vfork()) {
case -1:
advise ("fork", "unable to");
return -1;
#include <h/mh.h>
#include <h/signals.h>
-#include <setjmp.h>
+#include <h/m_setjmp.h>
#include <signal.h>
static char ansbuf[BUFSIZ];
SIGNAL_HANDLER istat = NULL;
char *cp, **cpp;
- if (!(setjmp (sigenv))) {
+ if (!(m_setjmp (sigenv))) {
istat = SIGNAL (SIGINT, intrser);
} else {
SIGNAL (SIGINT, istat);
--- /dev/null
+
+/*
+ * m_setjmp.h -- Wraps setjmp() and sigsetjmp(), to help prevent warnings
+ * -- about arguments and variables that might be clobbered by
+ * -- a setjmp call with gcc -Wclobbered.
+ *
+ * This code is Copyright (c) 2012, by the authors of nmh. See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
+ */
+
+#include <h/m_setjmp.h>
+
+
+int
+m_setjmp(jmp_buf env) {
+ return setjmp(env);
+}
+
+
+int
+m_sigsetjmp(sigjmp_buf env, int savesigs) {
+ return sigsetjmp(env, savesigs);
+}
+
--- /dev/null
+
+/*
+ * m_vfork.c -- Wraps vfork(), to help prevent warnings about arguments
+ * -- and variables that might be clobbered by a vfork call
+ * -- with gcc -Wclobbered.
+ *
+ * This code is Copyright (c) 2012, by the authors of nmh. See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
+ */
+
+#include <h/mh.h>
+
+pid_t
+m_vfork() {
+ return vfork();
+}
nested directories like the above code can.
-- Dan Harkless <dan-nmh@dilvish.speed.net> */
- switch (pid = vfork()) {
+ switch (pid = m_vfork()) {
case -1:
advise ("fork", "unable to");
return 0;
context_save(); /* save the context file */
fflush(stdout);
- switch (pid = vfork()) {
+ switch (pid = m_vfork()) {
case -1:
advise ("fork", "unable to");
return -1;
if (!strcmp (r1bindex (lproc, '/'), "mhl"))
lproc = mhlproc;
- switch (pid = vfork()) {
+ switch (pid = m_vfork()) {
case -1:
/* fork error */
advise ("fork", "unable to");
default:
if (!ce->ce_file) {
pid_t child_id;
- int i, len, buflen;
- volatile int xstdout;
+ int i, xstdout, len, buflen;
char *bp, **ap, *cp;
char *vec[4], buffer[BUFSIZ];
FILE *out;
if ((out = fopen (ce->ce_file, "w")) == NULL)
adios (ce->ce_file, "unable to open for writing");
- for (i = 0; (child_id = vfork()) == NOTOK && i > 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i > 5; i++)
sleep (5);
switch (child_id) {
case NOTOK:
#include <h/signals.h>
#include <h/md5.h>
#include <errno.h>
-#include <setjmp.h>
#include <signal.h>
#include <h/mts.h>
#include <h/tws.h>
#include <h/fmt_scan.h>
#include <h/tws.h>
#include <h/utils.h>
-#include <setjmp.h>
+#include <h/m_setjmp.h>
#include <signal.h>
/*
static void
-process (char *folder, char *volatile fname, int ofilen, int ofilec)
+process (char *folder, char *fname, int ofilen, int ofilec)
{
char *cp = NULL;
FILE *fp = NULL;
struct mcomp *c1;
- switch (setjmp (env)) {
+ switch (m_setjmp (env)) {
case OK:
if (fname) {
fp = mhl_action ? (*mhl_action) (fname) : fopen (fname, "r");
return NOTOK;
}
- for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
char *cp = NULL;
struct mcomp *c1;
- switch (setjmp (mhlenv)) {
+ switch (m_setjmp (mhlenv)) {
case OK:
cp = invo_name;
sleepsw = 0; /* XXX */
if (pipe (pd) == NOTOK)
adios ("pipe", "unable to");
- switch (m_pid = vfork ()) {
+ switch (m_pid = m_vfork()) {
case NOTOK:
adios ("fork", "unable to");
#include <h/signals.h>
#include <h/md5.h>
#include <errno.h>
-#include <setjmp.h>
#include <signal.h>
#include <h/mts.h>
#include <h/tws.h>
static int
openFTP (CT ct, char **file)
{
- int cachetype, fd;
- volatile int caching;
+ int cachetype, caching, fd;
int len, buflen;
char *bp, *ftp, *user, *pass;
char buffer[BUFSIZ], cachefile[BUFSIZ];
fflush (stdout);
- for (i = 0; (child_id = vfork ()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
case NOTOK:
vec[vecp++] = e->eb_body;
vec[vecp] = NULL;
- for (i = 0; (child_id = vfork ()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
case NOTOK:
#include <h/signals.h>
#include <h/md5.h>
#include <errno.h>
-#include <setjmp.h>
+#include <h/m_setjmp.h>
#include <signal.h>
#include <h/mts.h>
#include <h/tws.h>
fflush (stdout);
- for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
SIGNAL_HANDLER istat;
istat = SIGNAL (SIGINT, intrser);
- if ((intr = sigsetjmp (intrenv, 1)) == OK) {
+ if ((intr = m_sigsetjmp (intrenv, 1)) == OK) {
fflush (stdout);
prompt[0] = 0;
read (fileno (stdout), prompt, sizeof(prompt));
fflush (stdout);
- for (i = 0; (child_id = vfork ()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
case NOTOK:
#include <h/signals.h>
#include <h/md5.h>
#include <errno.h>
-#include <setjmp.h>
#include <signal.h>
#include <h/mts.h>
#include <h/tws.h>
#include <termios.h>
#include <pwd.h>
-#include <setjmp.h>
+#include <h/m_setjmp.h>
#include <signal.h>
#include <h/msh.h>
#include <h/vmhsbr.h>
{
int status;
- switch (setjmp (peerenv)) {
+ switch (m_setjmp (peerenv)) {
case OK:
SIGNAL (SIGALRM, alrmser);
alarm (ALARM);
#include <h/tws.h>
#include <h/mts.h>
#include <errno.h>
-#include <setjmp.h>
#include <signal.h>
#include <h/msh.h>
#include <h/picksbr.h>
#include <h/mts.h>
#include <errno.h>
-#include <setjmp.h>
#include <signal.h>
#ifdef HAVE_SYS_TIME_H
#include <h/signals.h>
#include <errno.h>
#include <signal.h>
-#include <setjmp.h>
+#include <h/m_setjmp.h>
#include <termios.h>
cp = buffer;
*cp = 0;
- switch (setjmp (sigenv)) {
+ switch (m_setjmp (sigenv)) {
case OK:
wtuser = 1;
break;
#include <h/mh.h>
#include <h/signals.h>
+#include <h/m_setjmp.h>
#include <h/rcvmail.h>
#include <h/scansbr.h>
#include <h/tws.h>
message_fd (char **vec)
{
pid_t child_id;
- int bytes, seconds;
- volatile int fd;
+ int bytes, fd, seconds;
char tmpfil[BUFSIZ];
struct stat st;
fd = mkstemp (strncpy (tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil)));
unlink (tmpfil);
- if ((child_id = vfork()) == NOTOK) {
+ if ((child_id = m_vfork()) == NOTOK) {
/* fork error */
close (fd);
return header_fd ();
} else if (child_id) {
/* parent process */
- if (!setjmp (myctx)) {
+ if (!m_setjmp (myctx)) {
SIGNAL (SIGALRM, alrmser);
bytes = fstat(fileno (stdin), &st) != NOTOK ? (int) st.st_size : 100;
if (stat (ttyspec, &st) == NOTOK || (st.st_mode & mask) == 0)
return;
- if (!setjmp (myctx)) {
+ if (!m_setjmp (myctx)) {
SIGNAL (SIGALRM, alrmser);
alarm (2);
td = open (ttyspec, O_WRONLY);
rewind (in);
lseek (fileno(in), (off_t) 0, SEEK_SET);
- switch (pid = vfork ()) {
+ switch (pid = m_vfork()) {
case NOTOK:
adios ("fork", "unable to");
#include <h/mh.h>
#include <h/signals.h>
-#include <setjmp.h>
+#include <h/m_setjmp.h>
#include <signal.h>
#include <fcntl.h>
#include <h/mime.h>
}
done=armed_done;
- switch (setjmp (env)) {
+ switch (m_setjmp (env)) {
case OK:
/*
* If given -push and -unique (which is undocumented), then
*/
static int
-sendaux (char **vec, int vecp, char *volatile drft, struct stat *st)
+sendaux (char **vec, int vecp, char *drft, struct stat *st)
{
pid_t child_id;
- int i, status;
- volatile int fd, fd2;
+ int i, status, fd, fd2;
char backup[BUFSIZ], buf[BUFSIZ];
fd = pushsw ? tmp_fd () : NOTOK;
done (1);
vec[vecp] = NULL;
- for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
#include <h/dropsbr.h>
#include <h/rcvmail.h>
#include <h/signals.h>
+#include <h/m_setjmp.h>
#include <h/tws.h>
#include <h/mts.h>
#include <h/utils.h>
default:
/* parent process */
- if (!setjmp (myctx)) {
+ if (! m_setjmp (myctx)) {
SIGNAL (SIGALRM, alrmser);
bytes = fstat (fd, &st) != -1 ? (int) st.st_size : 100;
if (pushflg && !(watch || verbose)) {
/* fork to a child to run sendmail */
- for (i=0; (pid = vfork()) == NOTOK && i < 5; i++)
+ for (i=0; (pid = m_vfork()) == NOTOK && i < 5; i++)
sleep(5);
switch (pid) {
case NOTOK:
else {
vec[0] = r1bindex (mhlproc, '/');
- for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
case NOTOK:
printf ("%sFcc: %s\n", msgstate == resent ? "Resent-" : "", folder);
fflush (stdout);
- for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
case NOTOK:
context_save (); /* save the context file */
fflush (stdout);
- switch (pid = vfork ()) {
+ switch (pid = m_vfork()) {
case NOTOK:
advise ("fork", "unable to");
status = NOTOK;
*/
static int
-sendfile (char **arg, char *file, volatile int pushsw)
+sendfile (char **arg, char *file, int pushsw)
{
pid_t child_id;
int i, vecp;
context_save (); /* save the context file */
fflush (stdout);
- for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
+ for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++)
sleep (5);
switch (child_id) {
case NOTOK:
context_save (); /* save the context file */
fflush (stdout);
- switch (pid = vfork ()) {
+ switch (pid = m_vfork()) {
case NOTOK:
advise ("fork", "unable to");
return 1;