void* write_fds[32];
int read_count = 0;
int write_count = 0;
-
fd_set rfds, wfds;
+ struct timeval timeout = {
+ .tv_sec = 0,
+ .tv_usec = 250000
+ };
+
/* get rdp fds */
- if (freerdp_get_fds(rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) {
+ if (!freerdp_get_fds(rdp_inst, read_fds, &read_count, write_fds, &write_count)) {
guac_client_log_error(client, "Unable to read RDP file descriptors.");
return 1;
}
/* get channel fds */
- if (freerdp_channels_get_fds(channels, rdp_inst, read_fds, &read_count, write_fds, &write_count) != 0) {
+ if (!freerdp_channels_get_fds(channels, rdp_inst, read_fds, &read_count, write_fds, &write_count)) {
guac_client_log_error(client, "Unable to read RDP channel file descriptors.");
return 1;
}
}
/* Otherwise, wait for file descriptors given */
- if (select(max_fd + 1, &rfds, &wfds, NULL, NULL) == -1) {
+ if (select(max_fd + 1, &rfds, &wfds, NULL, &timeout) == -1) {
/* these are not really errors */
if (!((errno == EAGAIN) ||
(errno == EWOULDBLOCK) ||
}
}
- /* check the libfreerdp fds */
- if (freerdp_check_fds(rdp_inst) != 0) {
+ /* Check the libfreerdp fds */
+ if (!freerdp_check_fds(rdp_inst)) {
guac_client_log_error(client, "Error handling RDP file descriptors.");
return 1;
}
- /* check channel fds */
- if (freerdp_channels_check_fds(channels, rdp_inst) != 0) {
+ /* Check channel fds */
+ if (!freerdp_channels_check_fds(channels, rdp_inst)) {
guac_client_log_error(client, "Error handling RDP channel file descriptors.");
return 1;
}