diff options
author | rpaulo <rpaulo@FreeBSD.org> | 2010-08-11 17:33:26 +0000 |
---|---|---|
committer | rpaulo <rpaulo@FreeBSD.org> | 2010-08-11 17:33:26 +0000 |
commit | afd44137e854c021c1e26e7a5d261dcf706ee9dc (patch) | |
tree | 6df5d79ff9e595481ae54191003939135774e4d9 /lib/libproc/proc_rtld.c | |
parent | 5688dd21e911eab4ec09be1089f77d8d58fff05c (diff) | |
download | FreeBSD-src-afd44137e854c021c1e26e7a5d261dcf706ee9dc.zip FreeBSD-src-afd44137e854c021c1e26e7a5d261dcf706ee9dc.tar.gz |
Several fixes for libproc:
o return the correct status in proc_wstatus()
o proc_read takes a void *
o correctly allocate the objs structure array
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'lib/libproc/proc_rtld.c')
-rw-r--r-- | lib/libproc/proc_rtld.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libproc/proc_rtld.c b/lib/libproc/proc_rtld.c index 5caadd9e..2a9ed39 100644 --- a/lib/libproc/proc_rtld.c +++ b/lib/libproc/proc_rtld.c @@ -42,14 +42,13 @@ map_iter(const rd_loadobj_t *lop, void *arg) { struct proc_handle *phdl = arg; - phdl->nobjs++; if (phdl->nobjs >= phdl->rdobjsz) { phdl->rdobjsz *= 2; phdl->rdobjs = realloc(phdl->rdobjs, phdl->rdobjsz); if (phdl->rdobjs == NULL) return (-1); } - memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*phdl->rdobjs)); + memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*lop)); return (0); } @@ -61,6 +60,7 @@ proc_rdagent(struct proc_handle *phdl) phdl->status != PS_IDLE) { if ((phdl->rdap = rd_new(phdl)) != NULL) { phdl->rdobjs = malloc(sizeof(*phdl->rdobjs) * 64); + phdl->rdobjsz = 64; if (phdl->rdobjs == NULL) return (phdl->rdap); rd_loadobj_iter(phdl->rdap, map_iter, phdl); @@ -73,7 +73,8 @@ proc_rdagent(struct proc_handle *phdl) void proc_updatesyms(struct proc_handle *phdl) { - memset(&phdl->rdobjs, 0, sizeof(*phdl->rdobjs) * phdl->rdobjsz); + + memset(phdl->rdobjs, 0, sizeof(*phdl->rdobjs) * phdl->rdobjsz); phdl->nobjs = 0; rd_loadobj_iter(phdl->rdap, map_iter, phdl); } |