2008-01-21 [colin] 3.2.0cvs57
authorColin Leroy <colin@colino.net>
Mon, 21 Jan 2008 07:56:11 +0000 (07:56 +0000)
committerColin Leroy <colin@colino.net>
Mon, 21 Jan 2008 07:56:11 +0000 (07:56 +0000)
* AUTHORS
* src/matcher.c
* src/mimeview.c
* src/common/ssl.c
* src/gtk/authors.h
Fix bug 1478, 'Wrong pthread_create calls all
over the place'. Patch by Christian Cornelssen

AUTHORS
ChangeLog
PATCHSETS
configure.ac
src/common/ssl.c
src/gtk/authors.h
src/matcher.c
src/mimeview.c

diff --git a/AUTHORS b/AUTHORS
index 12e3aef09cad4ab536d042498c3e311b53a06671..da2197e94938fa450965c4cd16564483f34de350 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -252,3 +252,4 @@ contributors (in addition to the above; based on Changelog)
        Frank Dietrich
        Federico Heinz
        Marius Glauser
+       Christian Cornelssen
index cf6ef562a5c9570a26ef47fa57e63f59cb56235e..5b4cdbedae3969b95dd2ddb22a0f61af6d37e20c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-01-21 [colin]     3.2.0cvs57
+
+       * AUTHORS
+       * src/matcher.c
+       * src/mimeview.c
+       * src/common/ssl.c
+       * src/gtk/authors.h
+               Fix bug 1478, 'Wrong pthread_create calls all 
+               over the place'. Patch by Christian Cornelssen
+
 2008-01-20 [colin]     3.2.0cvs56
 
        * src/imap.c
index 6f0e0c214a651ac294e30aa5cbdb6eb14f69c132..dd7650f76fe7dab12a2b1d0826333001da8324aa 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.229 -r 1.274.2.230 src/mainwindow.c;  ) > 3.2.0cvs54.patchset
 ( cvs diff -u -r 1.3.2.16 -r 1.3.2.17 src/folderutils.c;  ) > 3.2.0cvs55.patchset
 ( cvs diff -u -r 1.179.2.208 -r 1.179.2.209 src/imap.c;  cvs diff -u -r 1.1.4.94 -r 1.1.4.95 src/etpan/imap-thread.c;  cvs diff -u -r 1.1.4.22 -r 1.1.4.23 src/etpan/imap-thread.h;  ) > 3.2.0cvs56.patchset
+( cvs diff -u -r 1.100.2.58 -r 1.100.2.59 AUTHORS;  cvs diff -u -r 1.75.2.53 -r 1.75.2.54 src/matcher.c;  cvs diff -u -r 1.83.2.124 -r 1.83.2.125 src/mimeview.c;  cvs diff -u -r 1.9.2.25 -r 1.9.2.26 src/common/ssl.c;  cvs diff -u -r 1.1.2.44 -r 1.1.2.45 src/gtk/authors.h;  ) > 3.2.0cvs57.patchset
index 7f591dcf666dafa378d3986d5319395bf6198a7a..c574be3314bd38f031d19c8b4fca9e9f0e4ec928 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=2
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=56
+EXTRA_VERSION=57
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 3bcee8a7e06a81f14d857038cd583b1bf88df1af..053ac84b48ad403a085cecbf3cbb91d9f7349167 100644 (file)
@@ -123,9 +123,10 @@ static gint SSL_connect_nb(SSL *ssl)
 static gint SSL_connect_nb(gnutls_session ssl)
 #endif
 {
-#if (defined USE_PTHREAD && ((defined __GLIBC__ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))) || !defined __GLIBC__))
+#ifdef USE_PTHREAD
        thread_data *td = g_new0(thread_data, 1);
        pthread_t pt;
+       pthread_attr_t pta;
        void *res = NULL;
 #ifdef USE_GNUTLS
        int result;
@@ -139,14 +140,16 @@ static gint SSL_connect_nb(gnutls_session ssl)
        /* try to create a thread to initialize the SSL connection,
         * fallback to blocking method in case of problem 
         */
-       if (pthread_create(&pt, PTHREAD_CREATE_JOINABLE, 
-                       SSL_connect_thread, td) != 0) {
+       if (pthread_attr_init(&pta) != 0 ||
+           pthread_attr_setdetachstate(&pta, PTHREAD_CREATE_JOINABLE) != 0 ||
+           pthread_create(&pt, &pta, SSL_connect_thread, td) != 0) {
 #ifdef USE_OPENSSL
                return SSL_connect(ssl);
 #else
                do {
                        result = gnutls_handshake(td->ssl);
                } while (result == GNUTLS_E_AGAIN || result == GNUTLS_E_INTERRUPTED);
+               return result;
 #endif
        }
        debug_print("waiting for SSL_connect thread...\n");
index 5434ccf98f2427e647b0f15d21d81533bf00604e..511de954a0e78f21d2ff3c482e48f2a6bbe9f885 100644 (file)
@@ -99,6 +99,7 @@ static char *CONTRIBS_LIST[] = {
 "Tsu-Fan Cheng",
 "Manrat Chobchuen",
 "Rich Coe",
+"Christian Cornelssen",
 "George Danchev",
 "Matthieu Dazy",
 "Pierric Descamps",
index e272600e59cb42b2878eacb89ac73a7bdad04013..2eb96d3316489ba9b686c4b98fc210fd2d1254cf 100644 (file)
@@ -674,6 +674,7 @@ static gboolean matcherprop_match_test(const MatcherProp *prop,
        gint retval;
 #ifdef USE_PTHREAD
        pthread_t pt;
+       pthread_attr_t pta;
        thread_data *td = g_new0(thread_data, 1);
        void *res = NULL;
        time_t start_time = time(NULL);
@@ -688,7 +689,7 @@ static gboolean matcherprop_match_test(const MatcherProp *prop,
        if (cmd == NULL)
                return FALSE;
 
-#if (defined USE_PTHREAD && ((defined __GLIBC__ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))) || !defined __GLIBC__))
+#ifdef USE_PTHREAD
        /* debug output */
        if (debug_filtering_session
                        && prefs_common.filtering_debug_level >= FILTERING_DEBUG_LEVEL_HIGH) {
@@ -699,8 +700,9 @@ static gboolean matcherprop_match_test(const MatcherProp *prop,
 
        td->cmd = cmd;
        td->done = FALSE;
-       if (pthread_create(&pt, PTHREAD_CREATE_JOINABLE, 
-                       matcher_test_thread, td) != 0)
+       if (pthread_attr_init(&pta) != 0 ||
+           pthread_attr_setdetachstate(&pta, PTHREAD_CREATE_JOINABLE) != 0 ||
+           pthread_create(&pt, &pta, matcher_test_thread, td) != 0)
                retval = system(cmd);
        else {
                debug_print("waiting for test thread\n");
index 79ab62a34eaa4d76466c7f480c9cbafd7d6f1faf..2bb05367e0bd49cce4469401512f07911989ee73 100644 (file)
@@ -1025,14 +1025,12 @@ static void mimeview_check_sig_in_thread(MimeView *mimeview)
        mimeview->check_data->siginfo = mimeview->siginfo;
        debug_print("creating thread\n");
 
-       pthread_attr_init(&detach);
-       pthread_attr_setdetachstate(&detach, TRUE);
-
-       pthread_attr_init(&detach2);
-       pthread_attr_setdetachstate(&detach2, TRUE);
-
-       /* create the checker thread */
-       if (pthread_create(&th, &detach, 
+       /* init thread attributes and create the checker thread */
+       if (pthread_attr_init(&detach) != 0 ||
+           pthread_attr_setdetachstate(&detach, PTHREAD_CREATE_DETACHED) != 0 ||
+           pthread_attr_init(&detach2) != 0 ||
+           pthread_attr_setdetachstate(&detach2, PTHREAD_CREATE_DETACHED) != 0 ||
+           pthread_create(&th, &detach, 
                        mimeview_check_sig_worker_thread, 
                        mimeview) != 0) {
                /* arh. We'll do it synchronously. */
@@ -1063,7 +1061,7 @@ static void check_signature_cb(GtkWidget *widget, gpointer user_data)
 #endif
        noticeview_set_text(mimeview->siginfoview, _("Checking signature..."));
        GTK_EVENTS_FLUSH();
-#if (defined USE_PTHREAD && ((defined __GLIBC__ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))) || !defined __GLIBC__))
+#ifdef USE_PTHREAD
        /* let's do it non-blocking */
        mimeview_check_sig_in_thread(mimeview);
        if (!mimeview->check_data) /* let's check syncronously */