From 88b27ae07f694e90637c2a852b754539c2f70172 Mon Sep 17 00:00:00 2001 From: David Levine Date: Tue, 17 Jan 2012 17:33:29 -0600 Subject: [PATCH] Well the wrap of vfork() calls didn't work: its semantics don't allow that. So removed the wrapper and added -Wno-clobbered to gcc -Wextra. --- configure.ac | 4 ++-- h/prototypes.h | 1 - sbr/Makefile.in | 2 +- sbr/ext_hook.c | 2 +- sbr/folder_delmsgs.c | 2 +- sbr/m_vfork.c | 17 ----------------- sbr/makedir.c | 2 +- sbr/refile.c | 2 +- sbr/showfile.c | 2 +- uip/mhbuildsbr.c | 2 +- uip/mhlsbr.c | 4 ++-- uip/mhparse.c | 4 ++-- uip/mhshowsbr.c | 4 ++-- uip/rcvtty.c | 2 +- uip/replsbr.c | 2 +- uip/sendsbr.c | 2 +- uip/spost.c | 6 +++--- uip/whatnowsbr.c | 6 +++--- 18 files changed, 24 insertions(+), 42 deletions(-) delete mode 100644 sbr/m_vfork.c diff --git a/configure.ac b/configure.ac index 4f3d260..707322c 100644 --- a/configure.ac +++ b/configure.ac @@ -236,8 +236,8 @@ AC_SUBST(DISABLE_UNUSED_MACROS_WARNING)dnl AC_CACHE_CHECK(whether compiler supports -Wextra, nmh_cv_wextra, [nmh_saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS -Wextra" - AC_TRY_COMPILE([],[],nmh_cv_wextra=' -Wextra',echo -n no) + CFLAGS="$CFLAGS -Wextra -Wno-clobbered" + AC_TRY_COMPILE([],[],nmh_cv_wextra=' -Wextra -Wno-clobbered',echo -n no) CFLAGS="$nmh_saved_cflags"]) AC_CACHE_CHECK(whether compiler supports -Wno-pointer-sign, nmh_cv_has_noptrsign, diff --git a/h/prototypes.h b/h/prototypes.h index 0544306..12124cd 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -80,7 +80,6 @@ int m_putenv (char *, char *); 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 *); diff --git a/sbr/Makefile.in b/sbr/Makefile.in index c65828b..f5f7414 100644 --- a/sbr/Makefile.in +++ b/sbr/Makefile.in @@ -62,7 +62,7 @@ SRCS = addrsbr.c ambigsw.c atooi.c brkstring.c \ 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_setjmp.c m_vfork.c \ + m_maildir.c m_name.c m_setjmp.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 \ diff --git a/sbr/ext_hook.c b/sbr/ext_hook.c index 506457d..e94083b 100644 --- a/sbr/ext_hook.c +++ b/sbr/ext_hook.c @@ -23,7 +23,7 @@ ext_hook(char *hook_name, char *message_file_name_1, char *message_file_name_2) if ((hook = context_find(hook_name)) == (char *)0) return (OK); - switch (pid = m_vfork()) { + switch (pid = vfork()) { case -1: status = NOTOK; advise(NULL, "external database may be out-of-date."); diff --git a/sbr/folder_delmsgs.c b/sbr/folder_delmsgs.c index b812def..6bde76f 100644 --- a/sbr/folder_delmsgs.c +++ b/sbr/folder_delmsgs.c @@ -57,7 +57,7 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook) fflush (stdout); vec[0] = r1bindex (rmmproc, '/'); - switch (pid = m_vfork()) { + switch (pid = vfork()) { case -1: advise ("fork", "unable to"); return -1; diff --git a/sbr/m_vfork.c b/sbr/m_vfork.c deleted file mode 100644 index e35f0bc..0000000 --- a/sbr/m_vfork.c +++ /dev/null @@ -1,17 +0,0 @@ - -/* - * 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 - -pid_t -m_vfork() { - return vfork(); -} diff --git a/sbr/makedir.c b/sbr/makedir.c index bbeef80..4337b7c 100644 --- a/sbr/makedir.c +++ b/sbr/makedir.c @@ -85,7 +85,7 @@ makedir (char *dir) nested directories like the above code can. -- Dan Harkless */ - switch (pid = m_vfork()) { + switch (pid = vfork()) { case -1: advise ("fork", "unable to"); return 0; diff --git a/sbr/refile.c b/sbr/refile.c index a2a958d..fc2793c 100644 --- a/sbr/refile.c +++ b/sbr/refile.c @@ -34,7 +34,7 @@ refile (char **arg, char *file) context_save(); /* save the context file */ fflush(stdout); - switch (pid = m_vfork()) { + switch (pid = vfork()) { case -1: advise ("fork", "unable to"); return -1; diff --git a/sbr/showfile.c b/sbr/showfile.c index 17f84b9..59ae795 100644 --- a/sbr/showfile.c +++ b/sbr/showfile.c @@ -28,7 +28,7 @@ showfile (char **arg, char *file) if (!strcmp (r1bindex (lproc, '/'), "mhl")) lproc = mhlproc; - switch (pid = m_vfork()) { + switch (pid = vfork()) { case -1: /* fork error */ advise ("fork", "unable to"); diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index d417bef..2a3f899 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -1087,7 +1087,7 @@ raw: if ((out = fopen (ce->ce_file, "w")) == NULL) adios (ce->ce_file, "unable to open for writing"); - for (i = 0; (child_id = m_vfork()) == NOTOK && i > 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i > 5; i++) sleep (5); switch (child_id) { case NOTOK: diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index b494812..6335463 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -1587,7 +1587,7 @@ doface (struct mcomp *c1) return NOTOK; } - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { @@ -1761,7 +1761,7 @@ m_popen (char *name) if (pipe (pd) == NOTOK) adios ("pipe", "unable to"); - switch (m_pid = m_vfork()) { + switch (m_pid = vfork()) { case NOTOK: adios ("fork", "unable to"); diff --git a/uip/mhparse.c b/uip/mhparse.c index 265276d..e151062 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -2604,7 +2604,7 @@ openFTP (CT ct, char **file) fflush (stdout); - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { case NOTOK: @@ -2746,7 +2746,7 @@ openMail (CT ct, char **file) vec[vecp++] = e->eb_body; vec[vecp] = NULL; - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { case NOTOK: diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index ae90a7b..c60acb9 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -197,7 +197,7 @@ DisplayMsgHeader (CT ct, char *form) fflush (stdout); - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { @@ -564,7 +564,7 @@ show_content_aux2 (CT ct, int serial, int alternate, char *cracked, char *buffer fflush (stdout); - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { case NOTOK: diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 8e659ff..f61f0b9 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -192,7 +192,7 @@ message_fd (char **vec) fd = mkstemp (strncpy (tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil))); unlink (tmpfil); - if ((child_id = m_vfork()) == NOTOK) { + if ((child_id = vfork()) == NOTOK) { /* fork error */ close (fd); return header_fd (); diff --git a/uip/replsbr.c b/uip/replsbr.c index 7365b45..e2f63c5 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -466,7 +466,7 @@ replfilter (FILE *in, FILE *out, char *filter) rewind (in); lseek (fileno(in), (off_t) 0, SEEK_SET); - switch (pid = m_vfork()) { + switch (pid = vfork()) { case NOTOK: adios ("fork", "unable to"); diff --git a/uip/sendsbr.c b/uip/sendsbr.c index 63efbc0..f216e95 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -794,7 +794,7 @@ sendaux (char **vec, int vecp, char *drft, struct stat *st) done (1); vec[vecp] = NULL; - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { diff --git a/uip/spost.c b/uip/spost.c index 6defbac..187f9a0 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -428,7 +428,7 @@ main (int argc, char **argv) if (pushflg && !(watch || verbose)) { /* fork to a child to run sendmail */ - for (i=0; (pid = m_vfork()) == NOTOK && i < 5; i++) + for (i=0; (pid = vfork()) == NOTOK && i < 5; i++) sleep(5); switch (pid) { case NOTOK: @@ -764,7 +764,7 @@ make_bcc_file (void) else { vec[0] = r1bindex (mhlproc, '/'); - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { case NOTOK: @@ -825,7 +825,7 @@ fcc (char *file, char *folder) printf ("%sFcc: %s\n", msgstate == resent ? "Resent-" : "", folder); fflush (stdout); - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { case NOTOK: diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index 85c50b3..36ba346 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -696,7 +696,7 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp, context_save (); /* save the context file */ fflush (stdout); - switch (pid = m_vfork()) { + switch (pid = vfork()) { case NOTOK: advise ("fork", "unable to"); status = NOTOK; @@ -846,7 +846,7 @@ sendfile (char **arg, char *file, int pushsw) context_save (); /* save the context file */ fflush (stdout); - for (i = 0; (child_id = m_vfork()) == NOTOK && i < 5; i++) + for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++) sleep (5); switch (child_id) { case NOTOK: @@ -1349,7 +1349,7 @@ whomfile (char **arg, char *file) context_save (); /* save the context file */ fflush (stdout); - switch (pid = m_vfork()) { + switch (pid = vfork()) { case NOTOK: advise ("fork", "unable to"); return 1; -- 1.7.10.4