From 689eee076f9dc44bf46949caa22febf4436f3844 Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 31 Aug 2001 20:17:32 +0000 Subject: [PATCH] Simplify offset underflow checks even more --- lib/libc/stdio/ftell.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c index a0b5fa8d9ff7..9f1e106a51bd 100644 --- a/lib/libc/stdio/ftell.c +++ b/lib/libc/stdio/ftell.c @@ -114,8 +114,8 @@ _ftello(fp) * those from ungetc) cause the position to be * smaller than that in the underlying object. */ - pos -= fp->_r; - if (pos < 0) { + if ((pos -= fp->_r) < 0 || + (HASUB(fp) && (pos -= fp->_ur) < 0)) { fp->_p = fp->_bf._base; fp->_r = 0; if (HASUB(fp)) @@ -123,16 +123,6 @@ _ftello(fp) if (spos == -1) goto get_real_pos; pos = spos; - } else if (HASUB(fp)) { - pos -= fp->_ur; - if (pos < 0) { - fp->_p = fp->_bf._base; - fp->_r = 0; - FREEUB(fp); - if (spos == -1) - goto get_real_pos; - pos = spos; - } } } else if ((fp->_flags & __SWR) && fp->_p != NULL) { /*