mirror of
https://github.com/open-simh/simh.git
synced 2026-01-13 23:37:13 +00:00
Force return of SCPE_OPENERR when the same serial port is opened more than once.
This commit is contained in:
parent
8acb3b29e3
commit
eb1452913f
16
sim_serial.c
16
sim_serial.c
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user