When checking for bad filedescriptors, need to explicitly check for EBADF

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@673 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Peter Åstrand 2004-04-19 09:21:25 +00:00
parent 2df54194b1
commit c25c816370

View File

@ -38,6 +38,7 @@
#include <sys/time.h>
#include <dirent.h> /* opendir, closedir, readdir */
#include <time.h>
#include <errno.h>
#include "rdesktop.h"
#define IRP_MJ_CREATE 0x00
@ -824,7 +825,7 @@ rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, BOOL * t
reconnecting. FIXME: Real
support for reconnects. */
if (read(iorq->fd, &c, 0) != 0)
if ((read(iorq->fd, &c, 0) != 0) && (errno == EBADF))
break;
FD_SET(iorq->fd, rfds);
@ -847,7 +848,7 @@ rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, BOOL * t
case IRP_MJ_WRITE:
/* FD still valid? See above. */
if (write(iorq->fd, &c, 0) != 0)
if ((write(iorq->fd, &c, 0) != 0) && (errno == EBADF))
break;
FD_SET(iorq->fd, wfds);