aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ngctl/types.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2004-01-27 21:52:52 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2004-01-27 21:52:52 +0000
commit9fe5fadaf1156dc9f0372c8a8a2623bc202aeb5c (patch)
tree5e63f8550269f9b83d76d8bfe7d46bd7fcc78cae /usr.sbin/ngctl/types.c
parentd15ff417789ca1926d26a34db3d6c0137178cda6 (diff)
Notes
Diffstat (limited to 'usr.sbin/ngctl/types.c')
-rw-r--r--usr.sbin/ngctl/types.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/ngctl/types.c b/usr.sbin/ngctl/types.c
index b22e9a4a679a..30c5c168c6ca 100644
--- a/usr.sbin/ngctl/types.c
+++ b/usr.sbin/ngctl/types.c
@@ -52,9 +52,8 @@ const struct ngcmd types_cmd = {
static int
TypesCmd(int ac, char **av __unused)
{
- u_char rbuf[16 * 1024];
- struct ng_mesg *const resp = (struct ng_mesg *) rbuf;
- struct typelist *const tlist = (struct typelist *) resp->data;
+ struct ng_mesg *resp;
+ struct typelist *tlist;
int rtn = CMDRTN_OK;
u_int k;
@@ -72,12 +71,13 @@ TypesCmd(int ac, char **av __unused)
warn("send msg");
return(CMDRTN_ERROR);
}
- if (NgRecvMsg(csock, resp, sizeof(rbuf), NULL) < 0) {
+ if (NgAllocRecvMsg(csock, &resp, NULL) < 0) {
warn("recv msg");
return(CMDRTN_ERROR);
}
/* Show each type */
+ tlist = (struct typelist *) resp->data;
printf("There are %d total types:\n", tlist->numtypes);
if (tlist->numtypes > 0) {
printf("%15s Number of living nodes\n", "Type name");
@@ -89,6 +89,7 @@ TypesCmd(int ac, char **av __unused)
}
/* Done */
+ free(resp);
return (rtn);
}