mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
-Wall, which caught a real bug where buflen wasn't being set properly.
This commit is contained in:
parent
ba5d95967f
commit
b787589098
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58642
@ -71,6 +71,9 @@ static const char rcsid[] =
|
||||
|
||||
#include "kvm_private.h"
|
||||
|
||||
/* from src/lib/libc/gen/nlist.c */
|
||||
int __fdnlist __P((int, struct nlist *));
|
||||
|
||||
char *
|
||||
kvm_geterr(kd)
|
||||
kvm_t *kd;
|
||||
|
@ -289,9 +289,7 @@ scanradix(
|
||||
printf("%*.*s(0x%06x,%d) Submap ALL-FREE {\n",
|
||||
TABME,
|
||||
blk,
|
||||
radix,
|
||||
(int)meta.u.bmu_avail,
|
||||
meta.bm_bighint
|
||||
radix
|
||||
);
|
||||
}
|
||||
/*
|
||||
@ -323,9 +321,7 @@ scanradix(
|
||||
printf("%*.*s(0x%06x,%d) Submap ALL-ALLOCATED\n",
|
||||
TABME,
|
||||
blk,
|
||||
radix,
|
||||
(int)meta.u.bmu_avail,
|
||||
meta.bm_bighint
|
||||
radix
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@ -398,8 +394,8 @@ getswapinfo_radix(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max, int flags)
|
||||
blcopy.bl_free,
|
||||
blcopy.bl_blocks,
|
||||
blcopy.bl_radix,
|
||||
(blcopy.bl_rootblks * sizeof(blmeta_t) + 1023)/
|
||||
1024
|
||||
(int)((blcopy.bl_rootblks * sizeof(blmeta_t) + 1023)/
|
||||
1024)
|
||||
);
|
||||
}
|
||||
scanradix(
|
||||
|
@ -668,7 +668,8 @@ kvm_getargv(kd, kp, nchr)
|
||||
int nchr;
|
||||
{
|
||||
int oid[4];
|
||||
int i, l;
|
||||
int i;
|
||||
size_t bufsz;
|
||||
static int buflen;
|
||||
static char *buf, *p;
|
||||
static char **bufp;
|
||||
@ -681,11 +682,11 @@ kvm_getargv(kd, kp, nchr)
|
||||
}
|
||||
|
||||
if (!buflen) {
|
||||
l = sizeof(buflen);
|
||||
bufsz = sizeof(buflen);
|
||||
i = sysctlbyname("kern.ps_arg_cache_limit",
|
||||
&buflen, &l, NULL, 0);
|
||||
&buflen, &bufsz, NULL, 0);
|
||||
if (i == -1) {
|
||||
buflen == 0;
|
||||
buflen = 0;
|
||||
} else {
|
||||
buf = malloc(buflen);
|
||||
if (buf == NULL)
|
||||
@ -699,9 +700,9 @@ kvm_getargv(kd, kp, nchr)
|
||||
oid[1] = KERN_PROC;
|
||||
oid[2] = KERN_PROC_ARGS;
|
||||
oid[3] = kp->kp_proc.p_pid;
|
||||
l = buflen;
|
||||
i = sysctl(oid, 4, buf, &l, 0, 0);
|
||||
if (i == 0 && l > 0) {
|
||||
bufsz = buflen;
|
||||
i = sysctl(oid, 4, buf, &bufsz, 0, 0);
|
||||
if (i == 0 && bufsz > 0) {
|
||||
i = 0;
|
||||
p = buf;
|
||||
do {
|
||||
@ -712,7 +713,7 @@ kvm_getargv(kd, kp, nchr)
|
||||
bufp = realloc(bufp,
|
||||
sizeof(char *) * argc);
|
||||
}
|
||||
} while (p < buf + l);
|
||||
} while (p < buf + bufsz);
|
||||
bufp[i++] = 0;
|
||||
return (bufp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user