Tolerate ioctl failure in GetCommState() in order to be capable to use

softmodems.
This commit is contained in:
Alex Villacís Lasso 2005-09-27 09:32:17 +00:00 committed by Alexandre Julliard
parent e96faaa4c8
commit f89c69c4cf
1 changed files with 11 additions and 6 deletions

View File

@ -1491,17 +1491,22 @@ BOOL WINAPI GetCommState(
fd = get_comm_fd( handle, GENERIC_READ ); fd = get_comm_fd( handle, GENERIC_READ );
if (fd < 0) return FALSE; if (fd < 0) return FALSE;
if (tcgetattr(fd, &port) == -1 if (tcgetattr(fd, &port) == -1) {
#ifdef TIOCMGET
|| ioctl(fd, TIOCMGET, &stat) == -1
#endif
) {
int save_error=errno; int save_error=errno;
ERR("tcgetattr or ioctl error '%s'\n", strerror(save_error)); ERR("tcgetattr error '%s'\n", strerror(save_error));
COMM_SetCommError(handle,CE_IOE); COMM_SetCommError(handle,CE_IOE);
release_comm_fd( handle, fd ); release_comm_fd( handle, fd );
return FALSE; return FALSE;
} }
#ifdef TIOCMGET
if (ioctl(fd, TIOCMGET, &stat) == -1)
{
int save_error=errno;
WARN("ioctl error '%s'\n", strerror(save_error));
stat = DTR_CONTROL_ENABLE | RTS_CONTROL_ENABLE;
}
#endif
release_comm_fd( handle, fd ); release_comm_fd( handle, fd );
#ifndef __EMX__ #ifndef __EMX__
#ifdef CBAUD #ifdef CBAUD