nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] rmmproc Not Used for Lots of Messages; refile Copies.


From: David Levine
Subject: Re: [Nmh-workers] rmmproc Not Used for Lots of Messages; refile Copies.
Date: Sun, 02 Dec 2012 09:32:18 -0600

Ralph wrote:

> OK as long as the refile didn't create a copy before bailing on the rmm;
> as happens now.

To prevent that, how about this addition to refile.c:

diff --git a/uip/refile.c b/uip/refile.c
index 2bd12ed..76e41d0 100644
--- a/uip/refile.c
+++ b/uip/refile.c
@@ -182,6 +182,19 @@ main (int argc, char **argv)
     if (filep > 0) {
        if (folder || msgs.size)
            adios (NULL, "use -file or some messages, not both");
+
+       /* If using an rmmproc, check for MAXARGS overflow before
+          modifying anything.  If not using an rmmproc, we don't
+          pass the message files to another process, so this check
+          isn't necessary.  This check also isn't necessary if
+          NFOLDERS < MAXARGS - 1, because there's a check above for
+          filep <= NFOLDERS, but do it in that case just to be safe. */
+       if (rmmproc) {
+           if (filep > MAXARGS - 2)
+               adios (NULL, "more than %d messages for %s exec", MAXARGS - 2,
+                      rmmproc);
+       }
+
        opnfolds (folders, foldp);
        for (i = 0; i < filep; i++)
            if (m_file (files[i], folders, foldp, preserve, 0))
@@ -213,6 +226,17 @@ main (int argc, char **argv)
     for (msgnum = 0; msgnum < msgs.size; msgnum++)
        if (!m_convert (mp, msgs.msgs[msgnum]))
            done (1);
+
+    /* If using an rmmproc, check for MAXARGS overflow before
+       modifying anything.  If not using an rmmproc, we don't
+       pass the message files to another process, so this check
+       isn't necessary. */
+    if (rmmproc) {
+       if (mp->numsel > MAXARGS - 2)
+           adios (NULL, "more than %d messages for %s exec", MAXARGS - 2,
+                  rmmproc);
+    }
+
     seq_setprev (mp);  /* set the previous-sequence */
 
     /* create folder structures for each destination folder */

David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]