From 0ecf60c0b77f328d007521e54b05d0c3c183a117 Mon Sep 17 00:00:00 2001 From: fabient Date: Sat, 5 Jun 2010 22:57:53 +0000 Subject: Fix warnings found by Coverity. Found with: Coverity Prevent(tm) MFC after: 1 month --- usr.sbin/pmcstat/pmcpl_calltree.c | 8 +++++--- usr.sbin/pmcstat/pmcstat.c | 3 ++- usr.sbin/pmcstat/pmcstat_log.c | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pmcstat/pmcpl_calltree.c b/usr.sbin/pmcstat/pmcpl_calltree.c index 0955133..b0f1c6e 100644 --- a/usr.sbin/pmcstat/pmcpl_calltree.c +++ b/usr.sbin/pmcstat/pmcpl_calltree.c @@ -896,10 +896,12 @@ pmcpl_ct_node_printchild(struct pmcpl_ct_node *ct) /* Call address, line, sample. */ addr = ct->pct_image->pi_vaddr + ct->pct_func; line = 0; - pmcstat_image_addr2line(ct->pct_image, addr, sourcefile, + if (pmcstat_image_addr2line(ct->pct_image, addr, sourcefile, sizeof(sourcefile), &line, - funcname, sizeof(funcname)); - fprintf(args.pa_graphfile, "%p %u", (void *)addr, line); + funcname, sizeof(funcname))) + fprintf(args.pa_graphfile, "%p %u", (void *)addr, line); + else + fprintf(args.pa_graphfile, "* *"); } else fprintf(args.pa_graphfile, "* *"); diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c index 89ec8f0..9587529 100644 --- a/usr.sbin/pmcstat/pmcstat.c +++ b/usr.sbin/pmcstat/pmcstat.c @@ -292,7 +292,8 @@ pmcstat_find_targets(const char *spec) 0, &nproc)) == NULL) err(EX_OSERR, "ERROR: Cannot get process list: %s", kvm_geterr(pmcstat_kvm)); - } + } else + nproc = 0; if ((rv = regcomp(®, spec, REG_EXTENDED|REG_NOSUB)) != 0) { regerror(rv, ®, errbuf, sizeof(errbuf)); diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c index 3458bd3..a265cb9 100644 --- a/usr.sbin/pmcstat/pmcstat_log.c +++ b/usr.sbin/pmcstat/pmcstat_log.c @@ -1957,6 +1957,7 @@ pmcstat_keypress_log(void) case 'q': wprintw(w, "exiting..."); ret = 1; + break; default: if (plugins[args.pa_plugin].pl_topkeypress != NULL) if (plugins[args.pa_plugin].pl_topkeypress(c, w)) -- cgit v1.1