aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-06-09 06:15:42 +0300
committerArnold D. Robbins <arnold@skeeve.com>2013-06-09 06:15:42 +0300
commitfe4f4f372625682b10d5df11fef3c6f643e13410 (patch)
treec51053d2f9f373c4df1d680ee4dd05a4b8d8d998 /io.c
parent54a79f8f1dbb86f92dcb0c7623fddbde1c81278c (diff)
downloadegawk-fe4f4f372625682b10d5df11fef3c6f643e13410.tar.gz
egawk-fe4f4f372625682b10d5df11fef3c6f643e13410.tar.bz2
egawk-fe4f4f372625682b10d5df11fef3c6f643e13410.zip
Minor change in io.c:iop_finish.
Diffstat (limited to 'io.c')
-rw-r--r--io.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/io.c b/io.c
index 4921c82f..a918c390 100644
--- a/io.c
+++ b/io.c
@@ -2996,8 +2996,6 @@ iop_finish(IOBUF *iop)
if (isdir)
iop->errcode = EISDIR;
else {
- struct stat sbuf;
-
iop->errcode = EIO;
/*
* Extensions can supply values that are not
@@ -3005,8 +3003,10 @@ iop_finish(IOBUF *iop)
* file descriptors. So check the fd before
* trying to close it, which avoids errors
* on some operating systems.
+ *
+ * The fcntl call works for Windows, too.
*/
- if (fstat(iop->public.fd, & sbuf) == 0)
+ if (fcntl(iop->public.fd, F_GETFL) >= 0)
(void) close(iop->public.fd);
iop->public.fd = INVALID_HANDLE;
}