Re: PATCH: Fic pop3 mailbox bug



On 2001.09.05 19:25 M . Thielker wrote:
>Hi,
>
>Pawel, the mods to my pop3 patch broke it for my system. 
>Everytime I get new mail, I get "Unable to reopen mailbox". 
>The attached patch fixes it for my system.
>
>Melanie

The patch failed for me, but as I understand it, the patched code 
would be:

     if((m->inbox) && (tmp_mailbox->messages)) {
         if(libbalsa_messages_move(tmp_mailbox->message_list, m->inbox))
{
             unlink((const char*)tmp_path);
         } else {
             libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                                  _("Error placing messages from %s on
%s\n"
                                    "Messages are left in %s\n"),
                                  mailbox->name,
                                  LIBBALSA_MAILBOX(m->inbox)->name,
                                  tmp_path);
             libbalsa_mailbox_close(LIBBALSA_MAILBOX(tmp_mailbox));
         }
     } else {
         libbalsa_mailbox_close(LIBBALSA_MAILBOX(tmp_mailbox));
         unlink((const char*)tmp_path);
     }
     gtk_object_destroy(GTK_OBJECT(tmp_mailbox));
     g_free(tmp_path);
}

If the first two tests succeed, you unlink the file and then drop 
through to `gtk_object_destroy(GTK_OBJECT(tmp_mailbox));' without 
first closing `tmp_mailbox'. The intent of the other paths seems to be 
to achieve a close-unlink-destroy or close-destroy sequence. If 
unlink-destroy is an acceptable sequence, the code could be 
simplified; otherwise, you probably need another close.

Or have I missed something? The version I tried was:

    libbalsa_mailbox_open(tmp_mailbox);
    /* chbm: fixme - make this more linear */
    if ((m->inbox) && (tmp_mailbox->messages)
        && !libbalsa_messages_move(tmp_mailbox->message_list, m->inbox))
{
        libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                             _("Error placing messages from %s on %s\n"
                               "Messages are left in %s\n"),
                             mailbox->name,
                             LIBBALSA_MAILBOX(m->inbox)->name,
tmp_path);
        libbalsa_mailbox_close(LIBBALSA_MAILBOX(tmp_mailbox));
    } else {
        libbalsa_mailbox_close(LIBBALSA_MAILBOX(tmp_mailbox));
        unlink((const char *) tmp_path);
    }
    gtk_object_destroy(GTK_OBJECT(tmp_mailbox));
    g_free(tmp_path);
}

Peter




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