summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-02-20 01:56:13 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-02-20 01:56:13 +0000
commitba0d19ac3e8cb6bbf95bea5d7d76b2c4bea959b5 (patch)
treebfdb18515d1d43fba16490a9e549dfba6c4db5d7
parentec96fc1e0da994d5a08e8aecd9c6faa88dfe81bf (diff)
Change hard coded numbers to sizeof(buf). Also change some
sizeof(buf) - 1 to sizeof(buf), since fgets takes the whole buffer size. Based on diff from Charles Longeau <chl at tuxfamily dot org> long ago. OK millert@.
-rw-r--r--usr.bin/units/units.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c
index 09399bf6094..8335c156db4 100644
--- a/usr.bin/units/units.c
+++ b/usr.bin/units/units.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: units.c,v 1.11 2004/12/02 22:54:55 pat Exp $ */
+/* $OpenBSD: units.c,v 1.12 2007/02/20 01:56:12 ray Exp $ */
/* $NetBSD: units.c,v 1.6 1996/04/06 06:01:03 thorpej Exp $ */
/*
@@ -153,7 +153,7 @@ readunits(char *userfile)
}
}
while (!feof(unitfile)) {
- if (!fgets(line, 79, unitfile))
+ if (!fgets(line, sizeof(line), unitfile))
break;
linenum++;
lineptr = line;
@@ -713,7 +713,7 @@ main(int argc, char **argv)
initializeunit(&have);
if (!quiet)
printf("You have: ");
- if (!fgets(havestr, 80, stdin)) {
+ if (!fgets(havestr, sizeof(havestr), stdin)) {
if (!quiet)
putchar('\n');
exit(0);
@@ -724,7 +724,7 @@ main(int argc, char **argv)
initializeunit(&want);
if (!quiet)
printf("You want: ");
- if (!fgets(wantstr, 80, stdin)) {
+ if (!fgets(wantstr, sizeof(wantstr), stdin)) {
if (!quiet)
putchar('\n');
exit(0);