Subject: bin/841: rpcgen-ed files use bzero() not memset()
To: None <gnats-admin@NetBSD.ORG>
From: Luke Mewburn <lukem@dodo.melb.cpr.itg.telecom.com.au>
List: netbsd-bugs
Date: 03/02/1995 20:05:10
>Number: 841
>Category: bin
>Synopsis: rpcgen-ed files use bzero() not memset()
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 2 20:05:09 1995
>Originator: Luke Mewburn
>Organization:
" Werj"
>Release: 1.0
>Environment:
System: NetBSD dodo 1.0 NetBSD 1.0 (DODO) #7: Fri Dec 16 17:01:27 EST 1994 simonb@dodo:/slab/0/src/sys/arch/i386/compile/DODO i386
>Description:
I use netbsd rpcgen to generate files for other platforms
without it.
Unfortunately, generated files use bzero() which isn't always
available. Memset() is more available (and (ANSI? POSIX?) standard)
>How-To-Repeat:
Use rpcgen and notice that the resultant files have bzero()s
in them.
>Fix:
apply this patch. it also replaces one internal use of bzero
within rpcgen.
*** usr.bin/rpcgen/rpc_clntout.c.orig Thu Feb 23 21:16:20 1995
--- usr.bin/rpcgen/rpc_clntout.c Thu Feb 23 21:17:23 1995
***************
*** 113,119 ****
}
f_print(fout, "res;\n");
f_print(fout, "\n");
! f_print(fout, "\tbzero((char *)%sres, sizeof(res));\n",
ampr(proc->res_type));
f_print(fout,
"\tif (clnt_call(clnt, %s, xdr_%s, argp, xdr_%s, %sres, TIMEOUT) != RPC_SUCCESS) {\n",
--- 113,119 ----
}
f_print(fout, "res;\n");
f_print(fout, "\n");
! f_print(fout, "\tmemset((char *)%sres, 0, sizeof(res));\n",
ampr(proc->res_type));
f_print(fout,
"\tif (clnt_call(clnt, %s, xdr_%s, argp, xdr_%s, %sres, TIMEOUT) != RPC_SUCCESS) {\n",
*** usr.bin/rpcgen/rpc_svcout.c.orig Thu Feb 23 21:16:31 1995
--- usr.bin/rpcgen/rpc_svcout.c Thu Feb 23 21:17:12 1995
***************
*** 221,227 ****
f_print(fout, "\t\treturn;\n");
f_print(fout, "\t}\n");
! f_print(fout, "\tbzero((char *)&%s, sizeof(%s));\n", ARG, ARG);
printif("getargs", TRANSP, "(caddr_t)&", ARG);
printerr("decode", TRANSP);
f_print(fout, "\t\treturn;\n");
--- 221,228 ----
f_print(fout, "\t\treturn;\n");
f_print(fout, "\t}\n");
! f_print(fout, "\tmemset((char *)&%s, 0, sizeof(%s));\n", ARG,
! ARG);
printif("getargs", TRANSP, "(caddr_t)&", ARG);
printerr("decode", TRANSP);
f_print(fout, "\t\treturn;\n");
*** usr.bin/rpcgen/rpc_util.c.orig Thu Feb 23 21:19:41 1995
--- usr.bin/rpcgen/rpc_util.c Thu Feb 23 21:18:13 1995
***************
*** 63,69 ****
*/
reinitialize()
{
! bzero(curline, MAXLINESIZE);
where = curline;
linenum = 0;
defined = NULL;
--- 63,69 ----
*/
reinitialize()
{
! memset(curline, 0, MAXLINESIZE);
where = curline;
linenum = 0;
defined = NULL;
>Audit-Trail:
>Unformatted: