diff options
author | 1998-07-05 18:42:41 +0000 | |
---|---|---|
committer | 1998-07-05 18:42:41 +0000 | |
commit | 874fd739a99b7677281240b8d7b151b2945b6f47 (patch) | |
tree | 949099cd1dbb17f8e874b761923ac2f6fad2815d | |
parent | use STDERR_FILENO; kleink (diff) | |
download | wireguard-openbsd-874fd739a99b7677281240b8d7b151b2945b6f47.tar.xz wireguard-openbsd-874fd739a99b7677281240b8d7b151b2945b6f47.zip |
check kvm_read() better; msaitoh
-rw-r--r-- | usr.bin/fstat/fstat.c | 6 | ||||
-rw-r--r-- | usr.bin/nfsstat/nfsstat.c | 10 |
2 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 6026b922594..508b9b109c3 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fstat.c,v 1.14 1998/06/25 06:21:34 deraadt Exp $ */ +/* $OpenBSD: fstat.c,v 1.15 1998/07/05 18:42:41 deraadt Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -41,7 +41,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)fstat.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$OpenBSD: fstat.c,v 1.14 1998/06/25 06:21:34 deraadt Exp $"; +static char *rcsid = "$OpenBSD: fstat.c,v 1.15 1998/07/05 18:42:41 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -659,7 +659,7 @@ socktrans(sock, i) } if ((len = kvm_read(kd, (u_long)dom.dom_name, dname, - sizeof(dname) - 1)) < 0) { + sizeof(dname) - 1)) != sizeof(dname) -1) { dprintf(stderr, "can't read domain name at %p\n", dom.dom_name); dname[0] = '\0'; diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c index 50e7829e428..d5cae87e162 100644 --- a/usr.bin/nfsstat/nfsstat.c +++ b/usr.bin/nfsstat/nfsstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsstat.c,v 1.6 1997/01/15 23:42:57 millert Exp $ */ +/* $OpenBSD: nfsstat.c,v 1.7 1998/07/05 18:42:43 deraadt Exp $ */ /* $NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $ */ /* @@ -48,7 +48,7 @@ static char copyright[] = static char sccsid[] = "from: @(#)nfsstat.c 8.1 (Berkeley) 6/6/93"; static char *rcsid = "$NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $"; #else -static char *rcsid = "$OpenBSD: nfsstat.c,v 1.6 1997/01/15 23:42:57 millert Exp $"; +static char *rcsid = "$OpenBSD: nfsstat.c,v 1.7 1998/07/05 18:42:43 deraadt Exp $"; #endif #endif /* not lint */ @@ -169,7 +169,8 @@ intpr(nfsstataddr, display) { struct nfsstats nfsstats; - if (kvm_read(kd, (u_long)nfsstataddr, (char *)&nfsstats, sizeof(struct nfsstats)) < 0) { + if (kvm_read(kd, (u_long)nfsstataddr, (char *)&nfsstats, + sizeof(struct nfsstats)) != sizeof(struct nfsstats)) { fprintf(stderr, "nfsstat: kvm_read failed\n"); exit(1); } @@ -340,7 +341,8 @@ sidewaysintpr(interval, off, display) printhdr(); hdrcnt = 20; } - if (kvm_read(kd, off, (char *)&nfsstats, sizeof nfsstats) < 0) { + if (kvm_read(kd, off, (char *)&nfsstats, sizeof nfsstats) != + sizeof nfsstats) { fprintf(stderr, "nfsstat: kvm_read failed\n"); exit(1); } |