From 06f423f8a99a3a1d40551cc88cfdcb3a3fe84616 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 18 Sep 2024 10:56:39 +0200 Subject: 53093: silence compiler warning when USE_LSEEK is not defined --- Src/input.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'Src') diff --git a/Src/input.c b/Src/input.c index d8ac2c0e7..320fd6500 100644 --- a/Src/input.c +++ b/Src/input.c @@ -217,26 +217,23 @@ shinbufrestore(void) static int shingetchar(void) { - int nread, rsize = isset(SHINSTDIN) ? 1 : SHINBUFSIZE; + int nread; if (shinbufptr < shinbufendptr) return (unsigned char) *shinbufptr++; shinbufreset(); #ifdef USE_LSEEK - if (rsize == 1 && lseek(SHIN, 0, SEEK_CUR) != (off_t)-1) - rsize = SHINBUFSIZE; - if (rsize > 1) { + if (!isset(SHINSTDIN) || lseek(SHIN, 0, SEEK_CUR) != (off_t) -1) { do { errno = 0; - nread = read(SHIN, shinbuffer, rsize); + nread = read(SHIN, shinbuffer, SHINBUFSIZE); } while (nread < 0 && errno == EINTR); if (nread <= 0) return -1; if (isset(SHINSTDIN) && (shinbufendptr = memchr(shinbuffer, '\n', nread))) { - shinbufendptr++; - rsize = (shinbufendptr - shinbuffer); + int rsize = (++shinbufendptr - shinbuffer); if (nread > rsize && lseek(SHIN, -(nread - rsize), SEEK_CUR) < 0) zerr("lseek(%d, %d): %e", SHIN, -(nread - rsize), errno); -- cgit 1.4.1