1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-23 00:23:53 +03:00

Fixed sendto in oplock code.

Jeremy.
This commit is contained in:
Jeremy Allison
-
parent 68c0eb5ca7
commit 64974fa334
2 changed files with 17 additions and 2 deletions

View File

@@ -117,6 +117,21 @@ ssize_t sys_send(int s, const void *msg, size_t len, int flags)
return ret; return ret;
} }
/*******************************************************************
A sendto wrapper that will deal with EINTR.
********************************************************************/
ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
{
ssize_t ret;
do {
errno = 0;
ret = sendto(s, msg, len, flags, to, tolen);
} while (ret == -1 && errno == EINTR);
return ret;
}
/******************************************************************* /*******************************************************************
A recvfrom wrapper that will deal with EINTR. A recvfrom wrapper that will deal with EINTR.
********************************************************************/ ********************************************************************/

View File

@@ -417,7 +417,7 @@ oplocks. Returning success.\n"));
toaddr.sin_port = htons(from_port); toaddr.sin_port = htons(from_port);
toaddr.sin_family = AF_INET; toaddr.sin_family = AF_INET;
if(sendto( oplock_sock, msg_start, OPLOCK_BREAK_MSG_LEN, 0, if(sys_sendto( oplock_sock, msg_start, OPLOCK_BREAK_MSG_LEN, 0,
(struct sockaddr *)&toaddr, sizeof(toaddr)) < 0) { (struct sockaddr *)&toaddr, sizeof(toaddr)) < 0) {
DEBUG(0,("process_local_message: sendto process %d failed. Errno was %s\n", DEBUG(0,("process_local_message: sendto process %d failed. Errno was %s\n",
(int)remotepid, strerror(errno))); (int)remotepid, strerror(errno)));
@@ -930,7 +930,7 @@ dev = %x, inode = %.0f, file_id = %lu and no fsp found !\n",
(unsigned int)dev, (double)inode, file_id ); (unsigned int)dev, (double)inode, file_id );
} }
if(sendto(oplock_sock,op_break_msg,OPLOCK_BREAK_MSG_LEN,0, if(sys_sendto(oplock_sock,op_break_msg,OPLOCK_BREAK_MSG_LEN,0,
(struct sockaddr *)&addr_out,sizeof(addr_out)) < 0) { (struct sockaddr *)&addr_out,sizeof(addr_out)) < 0) {
if( DEBUGLVL( 0 ) ) { if( DEBUGLVL( 0 ) ) {
dbgtext( "request_oplock_break: failed when sending a oplock " ); dbgtext( "request_oplock_break: failed when sending a oplock " );