summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/amd/fsinfo/fsinfo.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/amd/fsinfo/fsinfo.c b/usr.sbin/amd/fsinfo/fsinfo.c
index de4923c2f3f..f1829f9026f 100644
--- a/usr.sbin/amd/fsinfo/fsinfo.c
+++ b/usr.sbin/amd/fsinfo/fsinfo.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)fsinfo.c 8.1 (Berkeley) 6/6/93
- * $Id: fsinfo.c,v 1.5 2002/06/10 21:07:14 itojun Exp $
+ * $Id: fsinfo.c,v 1.6 2002/08/04 23:04:31 pvalchev Exp $
*/
#ifndef lint
@@ -89,7 +89,8 @@ char *v[];
int ch;
int usage = 0;
char *iptr = idvbuf;
- int iptr_size = sizeof(idvbuf);
+ int iptr_size = sizeof(idvbuf);
+ size_t l;
while ((ch = getopt(c, v, "a:b:d:e:f:h:m:D:U:I:qv")) != -1)
switch (ch) {
@@ -131,10 +132,11 @@ char *v[];
verbose = 1;
break;
case 'I': case 'D': case 'U':
- if (snprintf(iptr, iptr_size, "-%c%s ", ch, optarg) >= iptr_size)
+ l = snprintf(iptr, iptr_size, "-%c%s ", ch, optarg);
+ if (l >= iptr_size || l < 0)
usage++;
else {
- size_t l = strlen(iptr);
+ l = strlen(iptr);
iptr_size -= l;
iptr += strlen(iptr);
}