Force return of SCPE_OPENERR when the same serial port is opened more than once.
This commit is contained in:
parent
8acb3b29e3
commit
eb1452913f
1 changed files with 16 additions and 0 deletions
16
sim_serial.c
16
sim_serial.c
|
@ -170,6 +170,16 @@ for (i=0; i<serial_open_device_count; ++i)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct open_serial_device *_get_open_device_byname (const char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i<serial_open_device_count; ++i)
|
||||||
|
if (0 == strcmp(name, serial_open_devices[i].name))
|
||||||
|
return &serial_open_devices[i];
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static struct open_serial_device *_serial_add_to_open_list (SERHANDLE port, TMLN *line, const char *name, const char *config)
|
static struct open_serial_device *_serial_add_to_open_list (SERHANDLE port, TMLN *line, const char *name, const char *config)
|
||||||
{
|
{
|
||||||
serial_open_devices = realloc(serial_open_devices, (++serial_open_device_count)*sizeof(*serial_open_devices));
|
serial_open_devices = realloc(serial_open_devices, (++serial_open_device_count)*sizeof(*serial_open_devices));
|
||||||
|
@ -421,6 +431,12 @@ else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_get_open_device_byname (savname)) {
|
||||||
|
if (stat)
|
||||||
|
*stat = SCPE_OPENERR;
|
||||||
|
return INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
port = sim_open_os_serial (savname);
|
port = sim_open_os_serial (savname);
|
||||||
|
|
||||||
if (port == INVALID_HANDLE) {
|
if (port == INVALID_HANDLE) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue