diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-05-30 21:20:49 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-05-30 21:20:49 +0300 |
commit | a25b9b39ac2c49b822328414240061f6d22ddef2 (patch) | |
tree | 7c402a087491fdb168828602eba91230cd0a66ff | |
parent | 9dfa2ba854a2d7b7835274cf60a31294664612f3 (diff) | |
download | egawk-a25b9b39ac2c49b822328414240061f6d22ddef2.tar.gz egawk-a25b9b39ac2c49b822328414240061f6d22ddef2.tar.bz2 egawk-a25b9b39ac2c49b822328414240061f6d22ddef2.zip |
Minor fix in io.c.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | io.c | 12 |
2 files changed, 19 insertions, 1 deletions
@@ -1,11 +1,19 @@ 2013-05-30 Arnold D. Robbins <arnold@skeeve.com> + More profiling fixes: + * profile.c (pprint): For Op_in_array, parenthesize subscript if the precedence is lower. E.g.: (c = tolower(foo)) in ARRAY. (prec_level): Merge cases for precedence of 5. (parenthesize): Simplify, as in 3.1.8. Avoids stuff like `(x == 1 && (z ==2 && (q == 4 && w == 7)))'. + Unrelated: + + * io.c (iop_finish): fstat the fd before closing it to avoid + errors on some operating systems. Thanks to Eli Zaretskii + for the report. + 2013-05-29 Arnold D. Robbins <arnold@skeeve.com> * profile.c (pp_group3): Renamed from pp_concat. Change all calls. @@ -2912,8 +2912,18 @@ iop_finish(IOBUF *iop) if (isdir) iop->errcode = EISDIR; else { + struct stat sbuf; + iop->errcode = EIO; - (void) close(iop->public.fd); + /* + * Extensions can supply values that are not + * INVALID_HANDLE but that are also not real + * file descriptors. So check the fd before + * trying to close it, which avoids errors + * on some operating systems. + */ + if (fstat(iop->public.fd, & sbuf) == 0) + (void) close(iop->public.fd); iop->public.fd = INVALID_HANDLE; } /* |