[bugfix] double close should be safe
This commit is contained in:
parent
9263891c4c
commit
d1aa42cd7a
|
@ -188,6 +188,9 @@ pic_get_output_string(pic_state *pic, struct pic_port *port)
|
||||||
void
|
void
|
||||||
pic_close_port(pic_state *pic, struct pic_port *port)
|
pic_close_port(pic_state *pic, struct pic_port *port)
|
||||||
{
|
{
|
||||||
|
if ((port->flags & PIC_PORT_OPEN) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (xfclose(port->file) == EOF) {
|
if (xfclose(port->file) == EOF) {
|
||||||
pic_errorf(pic, "close-port: failure");
|
pic_errorf(pic, "close-port: failure");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue