bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 4/7] Fix double call to pthread_mutex_unlock in S_socket_connect.


From: Cyril Roelandt
Subject: [PATCH 4/7] Fix double call to pthread_mutex_unlock in S_socket_connect.
Date: Mon, 17 Dec 2012 00:51:27 +0100

* pflocal/socker.c (S_socket_connect): fix redundant call to
pthread_mutex_unlock. There is no need to hold sock->lock to call
connq_connect_cancel, and sock->lock must be taken when leaving the if/else
blocks.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
---
 pflocal/socket.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pflocal/socket.c b/pflocal/socket.c
index 46749fe..65da748 100644
--- a/pflocal/socket.c
+++ b/pflocal/socket.c
@@ -139,11 +139,11 @@ S_socket_connect (struct sock_user *user, struct addr 
*addr)
                        sock_free (server);
                    }
 
-                 pthread_mutex_lock (&sock->lock);
                  if (err)
                    connq_connect_cancel (peer->listen_queue);
                }
 
+              pthread_mutex_lock (&sock->lock);
              /* We must set CONNECT_QUEUE to NULL, as no one else can
                 set it until we've done so.  */
              sock->connect_queue = NULL;
-- 
1.7.10.4




reply via email to

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