summaryrefslogtreecommitdiff
path: root/lib/ZClosePort.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ZClosePort.c')
-rw-r--r--lib/ZClosePort.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ZClosePort.c b/lib/ZClosePort.c
index 0853d00..27e7e18 100644
--- a/lib/ZClosePort.c
+++ b/lib/ZClosePort.c
@@ -18,10 +18,11 @@
Code_t ZClosePort()
{
- if (__Zephyr_fd >= 0)
+ if (__Zephyr_fd >= 0 && __Zephyr_open)
close(__Zephyr_fd);
__Zephyr_fd = -1;
-
+ __Zephyr_open = 0;
+
return (ZERR_NONE);
}