about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2024-09-18 10:56:39 +0200
committerOliver Kiddle <opk@zsh.org>2024-09-18 11:08:08 +0200
commit06f423f8a99a3a1d40551cc88cfdcb3a3fe84616 (patch)
tree41ae168df433da2b394ece0b095bce504d8c5fdd /Src
parentad4afde923bc6e809795c99544f5937d159c6bb9 (diff)
downloadzsh-06f423f8a99a3a1d40551cc88cfdcb3a3fe84616.tar.gz
zsh-06f423f8a99a3a1d40551cc88cfdcb3a3fe84616.tar.xz
zsh-06f423f8a99a3a1d40551cc88cfdcb3a3fe84616.zip
53093: silence compiler warning when USE_LSEEK is not defined
Diffstat (limited to 'Src')
-rw-r--r--Src/input.c11
1 files changed, 4 insertions, 7 deletions
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);