CVS: rdesktop rdpdr.c,1.31,1.32

Peter ?strand <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16837

Modified Files:
	rdpdr.c 
Log Message:
rdpdr_add_fds: Corrected patch that prevents adding invalid FDs to the
select FD sets.


Index: rdpdr.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdpdr.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** rdpdr.c	17 Apr 2004 06:58:30 -0000	1.31
--- rdpdr.c	19 Apr 2004 08:24:54 -0000	1.32
***************
*** 61,65 ****
  extern DEVICE_FNS disk_fns;
  extern FILEINFO g_fileinfo[];
!  
  static VCHANNEL *rdpdr_channel;
  
--- 61,65 ----
  extern DEVICE_FNS disk_fns;
  extern FILEINFO g_fileinfo[];
! 
  static VCHANNEL *rdpdr_channel;
  
***************
*** 815,826 ****
  	while (iorq != NULL)
  	{
! 		/* We need to test that the fd is still valid */
! 		if ((iorq->fd != 0) && (read(iorq->fd, &c, 0) == 0))
  		{
  			switch (iorq->major)
  			{
  				case IRP_MJ_READ:
  
  					FD_SET(iorq->fd, rfds);
  
  					// Check if io request timeout is smaller than current (but not 0).
--- 815,833 ----
  	while (iorq != NULL)
  	{
! 		if (iorq->fd != 0)
  		{
  			switch (iorq->major)
  			{
  				case IRP_MJ_READ:
+ 					/* Is this FD valid? FDs will
+ 					   be invalid when
+ 					   reconnecting. FIXME: Real
+ 					   support for reconnects. */
+ 
+ 					if (read(iorq->fd, &c, 0) != 0)
+ 						break;
  
  					FD_SET(iorq->fd, rfds);
+ 					*n = MAX(*n, iorq->fd);
  
  					// Check if io request timeout is smaller than current (but not 0).
***************
*** 836,847 ****
  						*timeout = True;
  					}
  					break;
  
  				case IRP_MJ_WRITE:
  					FD_SET(iorq->fd, wfds);
  					break;
  
  			}
! 			*n = MAX(*n, iorq->fd);
  		}
  
--- 843,860 ----
  						*timeout = True;
  					}
+ 
  					break;
  
  				case IRP_MJ_WRITE:
+ 					/* FD still valid? See above. */
+ 					if (write(iorq->fd, &c, 0) != 0)
+ 						break;
+ 
  					FD_SET(iorq->fd, wfds);
+ 					*n = MAX(*n, iorq->fd);
  					break;
  
  			}
! 
  		}
  



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.