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:14:57 +0000 (13:14 +0200)
source3/smbd/process.c

index f2aa23e3e09b334cb6f73578a053625b904f366a..99c98e3a377dd3f1b40b787bc31b9f9c73534b93 100644 (file)
@@ -48,8 +48,12 @@ static bool smbd_lock_socket_internal(struct smbd_server_connection *sconn)
 
        DEBUG(10,("pid[%d] wait for socket lock\n", (int)sys_getpid()));
 
-       ok = fcntl_lock(sconn->smb1.echo_handler.socket_lock_fd,
+       do {
+               ok = fcntl_lock(
+                       sconn->smb1.echo_handler.socket_lock_fd,
                        SMB_F_SETLKW, 0, 0, F_WRLCK);
+       } while (!ok && (errno == EINTR));
+
        if (!ok) {
                return false;
        }
@@ -80,8 +84,12 @@ static bool smbd_unlock_socket_internal(struct smbd_server_connection *sconn)
                return true;
        }
 
-       ok = fcntl_lock(sconn->smb1.echo_handler.socket_lock_fd,
+       do {
+               ok = fcntl_lock(
+                       sconn->smb1.echo_handler.socket_lock_fd,
                        SMB_F_SETLKW, 0, 0, F_UNLCK);
+       } while (!ok && (errno == EINTR));
+
        if (!ok) {
                return false;
        }