diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2021-04-19 14:08:56 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2021-04-19 14:08:56 +0000 |
commit | b0a38277d6ad477388e7164bb7297a4c753582ac (patch) | |
tree | 0bb4dff8ce68823e35967afa1c5c114908a69578 /usr.bin/awk/lib.c | |
parent | c3c34e2b4c55760e9c52e4c229192b9e9368704f (diff) |
RS ^-anchoring needs to know if it's reading the first record of a file.
Without this fix, when reading the first record of an input file named
on the command line, the regular expression engine will be
misconfigured, precluding a successful match. From Miguel Pineiro Jr
Diffstat (limited to 'usr.bin/awk/lib.c')
-rw-r--r-- | usr.bin/awk/lib.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index 8cbdd6d29c6..6ae55dab4f4 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.44 2020/12/18 21:36:24 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.45 2021/04/19 14:08:55 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -174,6 +174,7 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record * infile = stdin; else if ((infile = fopen(file, "r")) == NULL) FATAL("can't open file %s", file); + innew = true; setfval(fnrloc, 0.0); } c = readrec(&buf, &bufsize, infile, innew); |