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
This commit is contained in:
Kyle Evans 2020-02-22 03:14:05 +00:00
parent 5915b638b0
commit b63d2d683d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358235

View file

@ -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) {
/*