]> diplodocus.org Git - nmh/blobdiff - sbr/folder_delmsgs.c
Rearranged mhn.defaults.sh a bit: consolidated web-browser specific
[nmh] / sbr / folder_delmsgs.c
index 671ecc7cc5bc1a473cd40489b7335fad702071bb..ebbca2d48cfef6ab8ec5ef7fbb75e8d3e2aba906 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <h/mh.h>
  */
 
 #include <h/mh.h>
+#include <h/utils.h>
 
 /*
  * 1) If we are using an external rmmproc, then exec it.
 
 /*
  * 1) If we are using an external rmmproc, then exec it.
@@ -40,6 +41,14 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
        /* Mark that the sequence information has changed */
        mp->msgflags |= SEQMOD;
 
        /* Mark that the sequence information has changed */
        mp->msgflags |= SEQMOD;
 
+       /*
+        * Write out the sequence and context files; this will release
+        * any locks before the rmmproc is called.
+        */
+
+       seq_save (mp);
+       context_save ();
+
        vec = argsplit(rmmproc, &prog, &vecp);
 
        /*
        vec = argsplit(rmmproc, &prog, &vecp);
 
        /*
@@ -48,7 +57,8 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
         */
 
        if (mp->numsel + vecp + 1 > MAXARGS)
         */
 
        if (mp->numsel + vecp + 1 > MAXARGS)
-           vec = (char **) realloc (vec, (size_t) ((mp->numsel + vecp + 1) *
+           vec = (char **) mh_xrealloc (vec,
+                                         (size_t) ((mp->numsel + vecp + 1) *
                                                     sizeof(*vec)));
        if (vec == NULL)
            adios (NULL, "unable to allocate exec vector");
                                                     sizeof(*vec)));
        if (vec == NULL)
            adios (NULL, "unable to allocate exec vector");
@@ -61,7 +71,7 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
 
        fflush (stdout);
 
 
        fflush (stdout);
 
-       switch (pid = vfork()) {
+       switch (pid = fork()) {
        case -1:
            advise ("fork", "unable to");
            return -1;
        case -1:
            advise ("fork", "unable to");
            return -1;
@@ -104,7 +114,7 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
 
            if (unlink_msgs) {
                /* just unlink the messages */
 
            if (unlink_msgs) {
                /* just unlink the messages */
-               if (unlink (dp) == -1) {
+               if (m_unlink (dp) == -1) {
                    admonish (dp, "unable to unlink");
                    retval = -1;
                    continue;
                    admonish (dp, "unable to unlink");
                    retval = -1;
                    continue;
@@ -132,5 +142,12 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook)
     /* Mark that the sequence information has changed */
     mp->msgflags |= SEQMOD;
 
     /* Mark that the sequence information has changed */
     mp->msgflags |= SEQMOD;
 
+    /*
+     * Write out sequence and context files
+     */
+
+    seq_save (mp);
+    context_save ();
+
     return retval;
 }
     return retval;
 }