Bugzilla – Attachment 884 Details for
Bug 7231
ThinLinc client frequently fails to connect to agent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix issue with select for fifos
win32_select.patch (text/plain), 3.37 KB, created by
Henrik Andersson
on 2018-08-24 14:44:38 CEST
(
hide
)
Description:
Fix issue with select for fifos
Filename:
MIME Type:
Creator:
Henrik Andersson
Created:
2018-08-24 14:44:38 CEST
Size:
3.37 KB
patch
obsolete
>Index: openbsd-compat/win32-socket.c >=================================================================== >--- openbsd-compat/win32-socket.c (revision 33556) >+++ openbsd-compat/win32-socket.c (working copy) >@@ -663,58 +663,95 @@ > return ret; > } > >+static int >+_select_ttys(int nfds, fd_set *readfds, fd_set *writefds, >+ fd_set *exceptfds, struct timeval *timeout) >+{ >+ int i; > >-int >-win32_select(int nfds, fd_set *readfds, fd_set *writefds, >+ /* >+ * We have no good way of checking if a console handle is writeable, >+ * so we assume they always are and let the blocking handle it >+ */ >+ if (writefds != NULL) { >+ for (i = 0;i < writefds->fd_count;i++) { >+ if (isatty(writefds->fd_array[i])) >+ break; >+ } >+ >+ if (i != writefds->fd_count) { >+ fd_set newwr; >+ >+ FD_ZERO(&newwr); >+ >+ for (;i < writefds->fd_count;i++) { >+ if (isatty(writefds->fd_array[i])) >+ FD_SET(writefds->fd_array[i], &newwr); >+ } >+ >+ if (readfds != NULL) >+ FD_ZERO(readfds); >+ if (writefds != NULL) >+ FD_ZERO(writefds); >+ if (exceptfds != NULL) >+ FD_ZERO(exceptfds); >+ >+ memcpy(writefds, &newwr, sizeof(fd_set)); >+ >+ return writefds->fd_count; >+ } >+ } >+ >+ if (readfds != NULL) { >+ for (i = 0;i < readfds->fd_count;i++) { >+ if (isatty(readfds->fd_array[i])) >+ return win32_wait(readfds, writefds, exceptfds, timeout); >+ } >+ } >+ >+ return 0; >+} >+ >+ >+static int >+_select_fifos(int nfds, fd_set *readfds, fd_set *writefds, > fd_set *exceptfds, struct timeval *timeout) > { >- int ret; >- u_int i; >+ int i; > >- /* >- * We have no good way of checking if a console handle is writeable, >- * so we assume they always are and let the blocking handle it >- */ >- if (writefds != NULL) { >- for (i = 0;i < writefds->fd_count;i++) { >- if (isatty(writefds->fd_array[i])) >- break; >- } >+ if (writefds != NULL) { >+ for (i = 0;i < writefds->fd_count;i++) { >+ if (isafifo(writefds->fd_array[i])) >+ return win32_wait(readfds, writefds, exceptfds, timeout); >+ } >+ } > >- if (i != writefds->fd_count) { >- fd_set newwr; >+ if (readfds != NULL) { >+ for (i = 0;i < readfds->fd_count;i++) { >+ if (isafifo(readfds->fd_array[i])) >+ return win32_wait(readfds, writefds, exceptfds, timeout); >+ } >+ } > >- FD_ZERO(&newwr); >+ return 0; >+} > >- for (;i < writefds->fd_count;i++) { >- if (isatty(writefds->fd_array[i])) >- FD_SET(writefds->fd_array[i], &newwr); >- } > >- if (readfds != NULL) >- FD_ZERO(readfds); >- if (writefds != NULL) >- FD_ZERO(writefds); >- if (exceptfds != NULL) >- FD_ZERO(exceptfds); >+int >+win32_select(int nfds, fd_set *readfds, fd_set *writefds, >+ fd_set *exceptfds, struct timeval *timeout) >+{ >+ int ret; > >- memcpy(writefds, &newwr, sizeof(fd_set)); >+ ret = _select_ttys(nfds, readfds, writefds, exceptfds, timeout); >+ if (ret != 0) >+ return ret; > >- return writefds->fd_count; >- } >- } >+ ret = _select_fifos(nfds, readfds, writefds, exceptfds, timeout); >+ if (ret != 0) >+ return ret; > >- /* Need to use more Windows specific APIs when dealing with non-sockets */ >- if (readfds != NULL) { >- for (i = 0;i < readfds->fd_count;i++) { >- if (isatty(readfds->fd_array[i]) || >- isafifo(readfds->fd_array[i])) >- return win32_wait(readfds, writefds, exceptfds, timeout); >- } >- } >- > ret = select(nfds, readfds, writefds, exceptfds, timeout); >- > if (ret == SOCKET_ERROR) > errno = get_win32_error(); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 7231
: 884