summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-10-08 10:29:56 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-10-08 10:29:56 +0000
commita540b24b08f25df7ee9e28e5f909e4d941f5b502 (patch)
treef40755e6937ca16ed1794fed15c2346b9e5feb97 /lib
parent04605a58c3ed0e1365b5af935ae70c5a11d4d931 (diff)
Avoid a possible signed->unsigned assignment, fixes PR1709 (Claus Assmann)
millert@ ok
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/fgets.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/stdio/fgets.c b/lib/libc/stdio/fgets.c
index 206db2502dc..8c17df66f71 100644
--- a/lib/libc/stdio/fgets.c
+++ b/lib/libc/stdio/fgets.c
@@ -31,7 +31,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: fgets.c,v 1.5 2003/06/02 20:18:37 millert Exp $";
+static char rcsid[] = "$OpenBSD: fgets.c,v 1.6 2003/10/08 10:29:55 avsm Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -50,9 +50,9 @@ fgets(buf, n, fp)
register int n;
register FILE *fp;
{
- register size_t len;
- register char *s;
- register unsigned char *p, *t;
+ size_t len;
+ char *s;
+ unsigned char *p, *t;
if (n <= 0) /* sanity check */
return (NULL);
@@ -63,15 +63,15 @@ fgets(buf, n, fp)
/*
* If the buffer is empty, refill it.
*/
- if ((len = fp->_r) <= 0) {
+ if (fp->_r <= 0) {
if (__srefill(fp)) {
/* EOF/error: stop with partial or no line */
if (s == buf)
return (NULL);
break;
}
- len = fp->_r;
}
+ len = fp->_r;
p = fp->_p;
/*