s3: Cope with EINTR in smbd_[un]lock_socket
authorVolker Lendecke <vl@samba.org>
Tue, 19 Oct 2010 06:53:21 +0000 (08:53 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 20 Oct 2010 11:56:29 +0000 (13:56 +0200)
source3/smbd/process.c

index cf50417cff2428d4edd5e449dbb9aa67730d5f81..16ed0f60b701e688b1739986991daa6e55d39126 100644 (file)
@@ -36,8 +36,12 @@ bool smbd_lock_socket(struct smbd_server_connection *sconn)
 
        DEBUG(10,("pid[%d] wait for socket lock\n", (int)sys_getpid()));
 
-       ok = fcntl_lock(smbd_server_conn->smb1.echo_handler.socket_lock_fd,
+       do {
+               ok = fcntl_lock(
+                       smbd_server_conn->smb1.echo_handler.socket_lock_fd,
                        SMB_F_SETLKW, 0, 0, F_WRLCK);
+       } while (!ok && (errno == EINTR));
+
        if (!ok) {
                return false;
        }
@@ -55,8 +59,12 @@ bool smbd_unlock_socket(struct smbd_server_connection *sconn)
                return true;
        }
 
-       ok = fcntl_lock(smbd_server_conn->smb1.echo_handler.socket_lock_fd,
+       do {
+               ok = fcntl_lock(
+                       smbd_server_conn->smb1.echo_handler.socket_lock_fd,
                        SMB_F_SETLKW, 0, 0, F_UNLCK);
+       } while (!ok && (errno == EINTR));
+
        if (!ok) {
                return false;
        }