smbd: Fix CID 1414783 Double unlock
authorVolker Lendecke <vl@samba.org>
Tue, 10 Apr 2018 19:27:47 +0000 (21:27 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 11 Apr 2018 17:07:24 +0000 (19:07 +0200)
The loop is unnecessary, both susv4 as well as the Linux manpage
explicitly say:

> These functions shall not return an error code of [EINTR].

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/process.c

index df54a44b88409d74344986a8b3aa895f579f90de..f992e65fc90412bffccdaa096a4a08739a275f08 100644 (file)
@@ -162,15 +162,9 @@ static bool smbd_unlock_socket_internal(struct smbXsrv_connection *xconn)
 
 #ifdef HAVE_ROBUST_MUTEXES
        if (xconn->smb1.echo_handler.socket_mutex != NULL) {
-               int ret = EINTR;
-
-               while (ret == EINTR) {
-                       ret = pthread_mutex_unlock(
-                               xconn->smb1.echo_handler.socket_mutex);
-                       if (ret == 0) {
-                               break;
-                       }
-               }
+               int ret;
+               ret = pthread_mutex_unlock(
+                       xconn->smb1.echo_handler.socket_mutex);
                if (ret != 0) {
                        DEBUG(1, ("pthread_mutex_unlock failed: %s\n",
                                  strerror(ret)));