Force return of SCPE_OPENERR when the same serial port is opened more than once.

This commit is contained in:
Mark Pizzolato 2013-04-07 15:28:02 -07:00
parent 8acb3b29e3
commit eb1452913f

View file

@ -170,6 +170,16 @@ for (i=0; i<serial_open_device_count; ++i)
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)
{
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);
if (port == INVALID_HANDLE) {