From 12eaa3d55dfe840a2f7637e98f7b3a6be9867887 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 24 Feb 1995 08:15:27 +0000 Subject: [PATCH] Remove some unused variables and fix two blatant core dump triggers. --- lib/libkvm/kvm.c | 11 ++++++----- lib/libkvm/kvm_file.c | 5 ++--- lib/libkvm/kvm_proc.c | 4 +--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index b8d342b0e753..7b720754b88c 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -280,20 +280,21 @@ kvm_openfiles(uf, mf, sf, flag, errout) } kvm_t * -kvm_open(uf, mf, sf, flag, program) +kvm_open(uf, mf, sf, flag, errstr) const char *uf; const char *mf; const char *sf; int flag; - const char *program; + const char *errstr; { register kvm_t *kd; - if ((kd = malloc(sizeof(*kd))) == NULL && program != NULL) { - (void)fprintf(stderr, "%s: %s\n", strerror(errno)); + if ((kd = malloc(sizeof(*kd))) == NULL) { + (void)fprintf(stderr, "%s: %s\n", + errstr ? errstr : "kvm_open" , strerror(errno)); return (0); } - kd->program = program; + kd->program = errstr; return (_kvm_open(kd, uf, mf, sf, flag, NULL)); } diff --git a/lib/libkvm/kvm_file.c b/lib/libkvm/kvm_file.c index 398c36c83b62..1e1d6bd60a3b 100644 --- a/lib/libkvm/kvm_file.c +++ b/lib/libkvm/kvm_file.c @@ -78,10 +78,9 @@ kvm_deadfiles(kd, op, arg, filehead_o, nfiles) int op, arg, nfiles; long filehead_o; { - int buflen = kd->arglen, needed = buflen, error, n = 0; - struct file *fp, file, *filehead; + int buflen = kd->arglen, n = 0; + struct file *fp, *filehead; register char *where = kd->argspc; - char *start = where; /* * first copyout filehead diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index 381c830f770a..c7a95cbf5c59 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -465,6 +465,7 @@ kvm_argv(kd, p, addr, narg, maxcnt) return (kd->argv); } } + return (0); } static void @@ -579,9 +580,6 @@ kvm_uread(kd, p, uva, buf, len) char procfile[MAXPATHLEN]; ssize_t amount; int fd; - u_long tmpuva = uva; - int i; - char *chr; cp = buf;