svn commit: r358235 - head/bin/sh
Kyle Evans
kevans at FreeBSD.org
Sat Feb 22 03:14:06 UTC 2020
Author: kevans
Date: Sat Feb 22 03:14:05 2020
New Revision: 358235
URL: https://svnweb.freebsd.org/changeset/base/358235
Log:
sh: fix read builtin on 32-bit systems
Specifically, any system with a 32-bit size_t; -residue is calculated as a
32-bit *then* promoted to the 64-bit off_t and the result is ultimately
wrong. This resulted in what would appear to be truncated output, as only
the first line would be read.
Correct it by just making residue an off_t to begin with, since this is what
lseek will take anyways.
Reported by: antoine, dim
Triaged by: cem
Tested by: kevans
X-MFC-With: r358152
Modified:
head/bin/sh/miscbltin.c
Modified: head/bin/sh/miscbltin.c
==============================================================================
--- head/bin/sh/miscbltin.c Sat Feb 22 01:31:06 2020 (r358234)
+++ head/bin/sh/miscbltin.c Sat Feb 22 03:14:05 2020 (r358235)
@@ -117,7 +117,7 @@ fdgetc(struct fdctx *fdc, char *c)
static void
fdctx_destroy(struct fdctx *fdc)
{
- size_t residue;
+ off_t residue;
if (fdc->buflen > 1) {
/*
More information about the svn-src-head
mailing list