aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--io.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6698889a..fbc31fc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (iop_finish): Change fstat call to fcntl/F_GETFL per
+ Eli Z., for Windows.
+
2013-06-03 Arnold D. Robbins <arnold@skeeve.com>
* eval.c (unwind_stack): If exiting, don't worry about strange stuff
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;
}