When the serial port is closed, we need to ensure that the port handle is
properly reset for it to be detected as closed.
gcc/ada/
PR ada/104767
* libgnat/g-sercom__mingw.adb (Close): Reset port handle to -1.
* libgnat/g-sercom__linux.adb (Close): Likewise.
begin
if Port.H /= -1 then
Res := close (int (Port.H));
+ Port.H := -1;
end if;
end Close;
begin
if Port.H /= -1 then
Success := CloseHandle (HANDLE (Port.H));
+ Port.H := -1;
if Success = Win32.FALSE then
Raise_Error ("error closing the port");