diff options
author | 2019-12-02 22:17:32 +0000 | |
---|---|---|
committer | 2019-12-02 22:17:32 +0000 | |
commit | 5fbd5e42b6e8a8eb350fdd243f46cfefbc9d0b49 (patch) | |
tree | ec65908650d1ed62a7b684ae63306187b0056102 /usr.bin/patch/ed.c | |
parent | the dhcp6 printing doesn't need these files anymore. (diff) | |
download | wireguard-openbsd-5fbd5e42b6e8a8eb350fdd243f46cfefbc9d0b49.tar.xz wireguard-openbsd-5fbd5e42b6e8a8eb350fdd243f46cfefbc9d0b49.zip |
Use getline(3) to handle lines longer than 8192 bytes in patch files
Spotted by jsg@ when working on mesa. Diff tested by sthen@ in
a partial i386 bulk. Input from and ok jsg@ millert@
Diffstat (limited to 'usr.bin/patch/ed.c')
-rw-r--r-- | usr.bin/patch/ed.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/patch/ed.c b/usr.bin/patch/ed.c index ddaba056c38..3b83cb3f06b 100644 --- a/usr.bin/patch/ed.c +++ b/usr.bin/patch/ed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ed.c,v 1.3 2016/09/02 21:39:51 tobias Exp $ */ +/* $OpenBSD: ed.c,v 1.4 2019/12/02 22:17:32 jca Exp $ */ /* * Copyright (c) 2015 Tobias Stoeckmann <tobias@openbsd.org> @@ -80,7 +80,7 @@ do_ed_script(void) for (;;) { linepos = ftello(pfp); - if (pgets(buf, sizeof buf, pfp) == NULL) + if (pgetline(&buf, &bufsz, pfp) == -1) break; p_input_line++; @@ -247,7 +247,7 @@ write_lines(char *filename) putc('\n', ofp); } else if (line->src == SRC_PCH) { fseeko(pfp, line->pos.seek, SEEK_SET); - if (pgets(buf, sizeof buf, pfp) == NULL) + if (pgetline(&buf, &bufsz, pfp) == -1) fatal("unexpected end of file"); p = buf; if (line->subst != 0) |