This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

open() not handling previously opened serial port gracefully?


Hi,
I recently ran into a problem where my cygwin-based program was trying to open a serial port that was already opened by another windows app. Instead of the open() call failing & returning -1, the cygwin program dumped stack (tracing w/ gdb indicated that the failure was within the open() call - an access violation of some sort.) I don't remember this happening in the past (but don't have my older cygwin1.dll versions to test with) - can anyone verify this (and thus prove that I'm not doing anything silly at my end :) Thanks,

-Troy

Using: Windows 2000, cygwin.dll 1.3.14-1 or cygwin.dll 1.3.13-2, seems to only affect serial ports

Code is as follows:

#include <stdio.h>
#include <fcntl.h>

int main(void)
{
int fd1,fd2;
fd1 = open("COM1",O_RDWR);
sleep(1);
fd2 = open("COM1",O_RDWR);
sleep(1);
close(fd2);
close(fd1);
return(0);
}

Stackdump is as follows:

Exception: STATUS_ACCESS_VIOLATION at eip=61015D6A
eax=00000000 ebx=00000003 ecx=00000000 edx=00000000 esi=615B0968 edi=40000080
ebp=0022FA88 esp=0022FA20 program=C:\projects\tools\xxx.exe
cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
Stack trace:
Frame Function Args
0022FA88 61015D6A (615B0968, 00000000, 00000002, 00000094)
0022FB08 61028668 (615B0968, 0022FB40, 00000002, 00000094)
0022FEB8 61076E61 (00401090, 00000002, 00000094, 0000002F)
0022FEE0 004010EB (00000001, 0A040330, 0A040288, 00000001)
0022FF40 61007288 (610C7A34, FFFFFFFE, 0000002C, 610C7958)
0022FF90 6100753D (00000000, 00000000, 80430F47, 00000000)
0022FFB0 004026E2 (00401096, 037F0009, 0022FFF0, 77E9CA90)
0022FFC0 0040103C (00000000, 00000000, 7FFDF000, 00000000)
0022FFF0 77E9CA90 (00401000, 00000000, 000000C8, 00000100)
End of stack trace


--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]