Don't open the comm handle with GENERIC_WRITE via FILE_GetUnixHandle.

oldstable
Andreas Mohr 2001-01-26 00:20:05 +00:00 committed by Alexandre Julliard
parent 06e735d2ec
commit 819bff4d33
1 changed files with 11 additions and 11 deletions

View File

@ -1709,7 +1709,7 @@ BOOL WINAPI SetCommBreak(
#if defined(TIOCSBRK) && defined(TIOCCBRK) /* check if available for compilation */ #if defined(TIOCSBRK) && defined(TIOCCBRK) /* check if available for compilation */
int fd,result; int fd,result;
fd = FILE_GetUnixHandle( handle, GENERIC_WRITE ); fd = FILE_GetUnixHandle( handle, GENERIC_READ );
if(fd<0) { if(fd<0) {
TRACE("FILE_GetUnixHandle failed\n"); TRACE("FILE_GetUnixHandle failed\n");
return FALSE; return FALSE;
@ -1749,7 +1749,7 @@ BOOL WINAPI ClearCommBreak(
#if defined(TIOCSBRK) && defined(TIOCCBRK) /* check if available for compilation */ #if defined(TIOCSBRK) && defined(TIOCCBRK) /* check if available for compilation */
int fd,result; int fd,result;
fd = FILE_GetUnixHandle( handle, GENERIC_WRITE ); fd = FILE_GetUnixHandle( handle, GENERIC_READ );
if(fd<0) { if(fd<0) {
TRACE("FILE_GetUnixHandle failed\n"); TRACE("FILE_GetUnixHandle failed\n");
return FALSE; return FALSE;
@ -1789,7 +1789,7 @@ BOOL WINAPI EscapeCommFunction(
struct termios port; struct termios port;
TRACE("handle %d, function=%d\n", handle, nFunction); TRACE("handle %d, function=%d\n", handle, nFunction);
fd = FILE_GetUnixHandle( handle, GENERIC_WRITE ); fd = FILE_GetUnixHandle( handle, GENERIC_READ );
if(fd<0) { if(fd<0) {
FIXME("handle %d not found.\n",handle); FIXME("handle %d not found.\n",handle);
return FALSE; return FALSE;
@ -1906,7 +1906,7 @@ BOOL WINAPI PurgeComm(
TRACE("handle %d, flags %lx\n", handle, flags); TRACE("handle %d, flags %lx\n", handle, flags);
fd = FILE_GetUnixHandle( handle, GENERIC_WRITE ); fd = FILE_GetUnixHandle( handle, GENERIC_READ );
if(fd<0) { if(fd<0) {
FIXME("no handle %d found\n",handle); FIXME("no handle %d found\n",handle);
return FALSE; return FALSE;
@ -2011,7 +2011,7 @@ BOOL WINAPI SetupComm(
int fd; int fd;
FIXME("insize %ld outsize %ld unimplemented stub\n", insize, outsize); FIXME("insize %ld outsize %ld unimplemented stub\n", insize, outsize);
fd=FILE_GetUnixHandle( handle, GENERIC_WRITE ); fd=FILE_GetUnixHandle( handle, GENERIC_READ );
if(0>fd) { if(0>fd) {
FIXME("handle %d not found?\n",handle); FIXME("handle %d not found?\n",handle);
return FALSE; return FALSE;
@ -2108,7 +2108,7 @@ BOOL WINAPI SetCommState(
TRACE("%s %s\n",(lpdcb->fInX)?"IXON":"~IXON", TRACE("%s %s\n",(lpdcb->fInX)?"IXON":"~IXON",
(lpdcb->fOutX)?"IXOFF":"~IXOFF"); (lpdcb->fOutX)?"IXOFF":"~IXOFF");
fd = FILE_GetUnixHandle( handle, GENERIC_WRITE ); fd = FILE_GetUnixHandle( handle, GENERIC_READ );
if (fd < 0) { if (fd < 0) {
FIXME("no handle %d found\n",handle); FIXME("no handle %d found\n",handle);
return FALSE; return FALSE;
@ -2382,7 +2382,7 @@ BOOL WINAPI SetCommState(
int save_error=errno; int save_error=errno;
commerror = WinError(); commerror = WinError();
close( fd ); close( fd );
ERR("tcgetattr error '%s'\n", strerror(save_error)); ERR("tcsetattr error '%s'\n", strerror(save_error));
return FALSE; return FALSE;
} else { } else {
commerror = 0; commerror = 0;
@ -2708,7 +2708,7 @@ BOOL WINAPI SetCommTimeouts(
if (!ret) return FALSE; if (!ret) return FALSE;
/* FIXME: move this stuff to the server */ /* FIXME: move this stuff to the server */
fd = FILE_GetUnixHandle( hComm, GENERIC_WRITE ); fd = FILE_GetUnixHandle( hComm, GENERIC_READ );
if (fd < 0) { if (fd < 0) {
FIXME("no fd for handle = %0x!.\n",hComm); FIXME("no fd for handle = %0x!.\n",hComm);
return FALSE; return FALSE;
@ -2746,14 +2746,14 @@ BOOL WINAPI GetCommModemStatus(
*lpModemStat=0; *lpModemStat=0;
#ifdef TIOCMGET #ifdef TIOCMGET
fd = FILE_GetUnixHandle( hFile, GENERIC_WRITE ); fd = FILE_GetUnixHandle( hFile, GENERIC_READ );
if(fd<0) if(fd<0)
return FALSE; return FALSE;
result = ioctl(fd, TIOCMGET, &mstat); result = ioctl(fd, TIOCMGET, &mstat);
close(fd); close(fd);
if (result == -1) if (result == -1)
{ {
TRACE("ioctl failed\n"); WARN("ioctl failed\n");
return FALSE; return FALSE;
} }
#ifdef TIOCM_CTS #ifdef TIOCM_CTS
@ -2773,7 +2773,7 @@ BOOL WINAPI GetCommModemStatus(
if (mstat & TIOCM_CAR) if (mstat & TIOCM_CAR)
*lpModemStat |= MS_RLSD_ON; *lpModemStat |= MS_RLSD_ON;
#endif #endif
TRACE("%s%s%s%s\n", TRACE("%04x -> %s%s%s%s\n", mstat,
(*lpModemStat &MS_RLSD_ON)?"MS_RLSD_ON ":"", (*lpModemStat &MS_RLSD_ON)?"MS_RLSD_ON ":"",
(*lpModemStat &MS_RING_ON)?"MS_RING_ON ":"", (*lpModemStat &MS_RING_ON)?"MS_RING_ON ":"",
(*lpModemStat &MS_DSR_ON)?"MS_DSR_ON ":"", (*lpModemStat &MS_DSR_ON)?"MS_DSR_ON ":"",