commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, master, updated. release-2.2-324-gc55e224


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-324-gc55e224
Date: Sat, 25 Dec 2010 10:32:20 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=c55e2241a6809305301e4a582564daac3e44fd6f

The branch, master has been updated
       via  c55e2241a6809305301e4a582564daac3e44fd6f (commit)
      from  f8834aef0820f19013af3ac91856480452224440 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c55e2241a6809305301e4a582564daac3e44fd6f
Author: Sergey Poznyakoff <address@hidden>
Date:   Sat Dec 25 12:28:55 2010 +0200

    pop client and movemail: bugfixes
    
    * libproto/pop/mbox.c (pop_close): Destroy the cached data.
    (pop_destroy): Avoid freeing the same data twice.
    (pop_body_get_stream,pop_body_size,pop_body_lines): Owner is mu_message_t.
    (pop_create_body): Change the owner of the created mu_body_t object.
    
    * movemail/movemail.c: Correctly close both mailboxes if unhandled errors
    occur.

-----------------------------------------------------------------------

Summary of changes:
 libproto/pop/mbox.c |   55 +++++++++++++++++++++++++++-----------------------
 movemail/movemail.c |    8 ++----
 2 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/libproto/pop/mbox.c b/libproto/pop/mbox.c
index 6160d0d..30570f1 100644
--- a/libproto/pop/mbox.c
+++ b/libproto/pop/mbox.c
@@ -198,7 +198,24 @@ pop_close (mu_mailbox_t mbox)
   status = mu_pop3_disconnect (mpd->pop3);
   if (status)
     mu_error ("mu_pop3_disconnect failed: %s", mu_strerror (status));
-  mu_pop3_destroy (&mpd->pop3);
+  if (mpd->msg)
+    {
+      size_t i;
+      
+      mu_monitor_wrlock (mbox->monitor);
+      /* Destroy the pop messages and resources associated to them.  */
+      for (i = 0; i < mpd->msg_count; i++)
+       {
+         if (mpd->msg[i])
+           {
+             mu_message_destroy (&mpd->msg[i]->message, mpd->msg[i]);
+             if (mpd->msg[i]->uidl)
+               free (mpd->msg[i]->uidl);
+             free (mpd->msg[i]);
+           }
+       }
+      mu_monitor_unlock (mbox->monitor);
+    }
   mu_stream_destroy (&mpd->cache);
   return 0;
 }
@@ -209,28 +226,11 @@ pop_destroy (mu_mailbox_t mbox)
   struct _pop3_mailbox *mpd = mbox->data;
   if (mpd)
     {
-       size_t i;
-      mu_monitor_wrlock (mbox->monitor);
-      if (mpd->msg)
-       {
-         /* Destroy the pop messages and resources associated to them.  */
-         for (i = 0; i < mpd->msg_count; i++)
-           {
-             if (mpd->msg[i])
-               {
-                 mu_message_destroy (&mpd->msg[i]->message, mpd->msg[i]);
-                 if (mpd->msg[i]->uidl)
-                   free (mpd->msg[i]->uidl);
-                 free (mpd->msg[i]);
-               }
-           }
-       }
       mu_pop3_destroy (&mpd->pop3);
       if (mpd->user)
        free (mpd->user);
       if (mpd->secret)
        mu_secret_unref (mpd->secret);
-      mu_stream_destroy (&mpd->cache);
    }
 }
 
@@ -682,7 +682,8 @@ pop_create_attribute (struct _pop3_message *mpm)
 int
 pop_body_get_stream (mu_body_t body, mu_stream_t *pstr)
 {
-  struct _pop3_message *mpm = mu_body_get_owner (body);
+  mu_message_t msg = mu_body_get_owner (body);
+  struct _pop3_message *mpm = mu_message_get_owner (msg);
   struct _pop3_mailbox *mpd = mpm->mpd;
   int status = pop_scan_message (mpm);
   if (status)
@@ -695,7 +696,8 @@ pop_body_get_stream (mu_body_t body, mu_stream_t *pstr)
 static int
 pop_body_size (mu_body_t body, size_t *psize)
 {
-  struct _pop3_message *mpm = mu_body_get_owner (body);
+  mu_message_t msg = mu_body_get_owner (body);
+  struct _pop3_message *mpm = mu_message_get_owner (msg);
   int status = pop_scan_message (mpm);
   if (status)
     return status;
@@ -706,7 +708,8 @@ pop_body_size (mu_body_t body, size_t *psize)
 static int
 pop_body_lines (mu_body_t body, size_t *plines)
 {
-  struct _pop3_message *mpm = mu_body_get_owner (body);
+  mu_message_t msg = mu_body_get_owner (body);
+  struct _pop3_message *mpm = mu_message_get_owner (msg);
   int status = pop_scan_message (mpm);
   if (status)
     return status;
@@ -719,14 +722,16 @@ pop_create_body (struct _pop3_message *mpm)
 {
   int status;
   mu_body_t body = NULL;
+  mu_message_t msg = mpm->message;
 
-  status = mu_body_create (&body, mpm);
+  /* FIXME: The owner of the body *must* be the message it belongs to. */
+  status = mu_body_create (&body, msg);
   if (status)
     return status;
 
-  mu_body_set_get_stream (body, pop_body_get_stream, mpm);
-  mu_body_set_size (body, pop_body_size, mpm);
-  mu_body_set_lines (body, pop_body_lines, mpm);
+  mu_body_set_get_stream (body, pop_body_get_stream, msg);
+  mu_body_set_size (body, pop_body_size, msg);
+  mu_body_set_lines (body, pop_body_lines, msg);
 
   mu_message_set_body (mpm->message, body, mpm);
 
diff --git a/movemail/movemail.c b/movemail/movemail.c
index bc25ad7..9a0133f 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -1032,8 +1032,9 @@ main (int argc, char **argv)
     }
   
   if (app_err_count && !(onerror_flags & (ONERROR_DELETE|ONERROR_COUNT)))
-    /* FIXME: mailboxes are not properly closed */
-    return 1;
+    preserve_mail = 1;
+  if (onerror_flags & ONERROR_COUNT)
+    app_err_count = 0;
       
   mu_mailbox_sync (dest);
   rc = mu_mailbox_close (dest);
@@ -1045,9 +1046,6 @@ main (int argc, char **argv)
 
   mu_mailbox_close (source);
   mu_mailbox_destroy (&source);
-
-  if (onerror_flags & ONERROR_COUNT)
-    app_err_count = 0;
   
   return !(rc == 0 && (app_err_count + get_err_count) == 0);
 }


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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