-/* $OpenBSD: FIXES,v 1.42 2021/11/12 15:16:58 millert Exp $ */
+/* $OpenBSD: FIXES,v 1.43 2022/01/27 16:58:37 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
+December 8, 2021:
+ The error handling in closefile and closeall was mangled. Long
+ standing warnings had been made fatal and some fatal errors went
+ undetected. Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>.
+
Nov 03, 2021:
getline accesses uninitialized data after getrec()
returns 0 on EOF and leaves the contents of buf unchanged.
-$OpenBSD: README.md,v 1.5 2021/11/02 15:29:41 millert Exp $
+$OpenBSD: README.md,v 1.6 2022/01/27 16:58:37 millert Exp $
# The One True Awk
distribute `FIXES` with it.
If you find errors, please report them
-to bwk@cs.princeton.edu.
+to the current maintainer, ozan.yigit@gmail.com.
Please _also_ open an issue in the GitHub issue tracker, to make
it easy to track issues.
Thanks.
If your system does not have `yacc` or `bison` (the GNU
equivalent), you need to install one of them first.
-NOTE: This version uses ANSI C (C 99), as you should also. We have
+NOTE: This version uses ISO/IEC C99, as you should also. We have
compiled this without any changes using `gcc -Wall` and/or local C
compilers on a variety of systems, but new systems or compilers
may raise some new complaint; reports of difficulties are
## A Note About Releases
-We don't do releases.
+We don't usually do releases.
## A Note About Maintenance
#### Last Updated
-Sat Jul 25 14:00:07 EDT 2021
+Sun 23 Jan 2022 03:48:01 PM EST
+
-/* $OpenBSD: run.c,v 1.70 2021/11/01 18:28:24 millert Exp $ */
+/* $OpenBSD: run.c,v 1.71 2022/01/27 16:58:37 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
return "???";
}
- Cell *closefile(Node **a, int n)
- {
+Cell *closefile(Node **a, int n)
+{
Cell *x;
size_t i;
bool stat;
for (i = 0; i < nfiles; i++) {
if (!files[i].fname || strcmp(x->sval, files[i].fname) != 0)
continue;
- if (ferror(files[i].fp))
- FATAL("i/o error occurred on %s", files[i].fname);
+ if (files[i].mode == GT || files[i].mode == '|')
+ fflush(files[i].fp);
+ if (ferror(files[i].fp)) {
+ if ((files[i].mode == GT && files[i].fp != stderr)
+ || files[i].mode == '|')
+ FATAL("write error on %s", files[i].fname);
+ else
+ WARNING("i/o error occurred on %s", files[i].fname);
+ }
if (files[i].fp == stdin || files[i].fp == stdout ||
files[i].fp == stderr)
stat = freopen("/dev/null", "r+", files[i].fp) == NULL;
else
stat = fclose(files[i].fp) == EOF;
if (stat)
- FATAL("i/o error occurred closing %s", files[i].fname);
+ WARNING("i/o error occurred closing %s", files[i].fname);
if (i > 2) /* don't do /dev/std... */
xfree(files[i].fname);
files[i].fname = NULL; /* watch out for ref thru this */
x = gettemp();
setfval(x, (Awkfloat) (stat ? -1 : 0));
return(x);
- }
+}
void closeall(void)
{
for (i = 0; i < nfiles; i++) {
if (! files[i].fp)
continue;
- if (ferror(files[i].fp))
- FATAL( "i/o error occurred on %s", files[i].fname );
- if (files[i].fp == stdin)
+ if (files[i].mode == GT || files[i].mode == '|')
+ fflush(files[i].fp);
+ if (ferror(files[i].fp)) {
+ if ((files[i].mode == GT && files[i].fp != stderr)
+ || files[i].mode == '|')
+ FATAL("write error on %s", files[i].fname);
+ else
+ WARNING("i/o error occurred on %s", files[i].fname);
+ }
+ if (files[i].fp == stdin || files[i].fp == stdout ||
+ files[i].fp == stderr)
continue;
if (files[i].mode == '|' || files[i].mode == LE)
stat = pclose(files[i].fp) == -1;
- else if (files[i].fp == stdout || files[i].fp == stderr)
- stat = fflush(files[i].fp) == EOF;
else
stat = fclose(files[i].fp) == EOF;
if (stat)
- FATAL( "i/o error occurred while closing %s", files[i].fname );
+ WARNING("i/o error occurred while closing %s", files[i].fname);
}
}