1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

sunrpc: Adjust RPC function declarations to match Sun's (bug 26686]

Building Glibc with the latest GCC 11 shows a number of instances
of the new -Warray-parameter warning designed to encourage
consistency in the forms of array arguments in redeclarations of
the same function (and, ultimately, to enable the detection of out
of bounds accesses via such arguments).

To avoid the subset of these warnings for the RPC APIs, this patch
changes the declarations of these functions to match both their
definitions and the Oracle RPC documentation.

Besides avoiding the -Warray-parameter warnings the effect of this
change is for GCC to issue warnings when either the functions are
passed an array with fewer than MAXNETNAMELEN + 1 elements, or when
the functions themselves access elements outside the array bounds.
This commit is contained in:
Martin Sebor
2020-10-08 12:53:09 -06:00
parent 3eff7504ca
commit c5db00dc30
2 changed files with 7 additions and 6 deletions

View File

@ -142,7 +142,7 @@ typedef int (*netname2user_function) (const char netname[MAXNETNAMELEN + 1],
uid_t *, gid_t *, int *, gid_t *);
int
netname2user (const char netname[MAXNETNAMELEN + 1], uid_t * uidp, gid_t * gidp,
netname2user (const char *netname, uid_t * uidp, gid_t * gidp,
int *gidlenp, gid_t * gidlist)
{
static service_user *startp;
@ -189,8 +189,7 @@ libc_hidden_nolink_sunrpc (netname2user, GLIBC_2_1)
#endif
int
netname2host (const char netname[MAXNETNAMELEN + 1], char *hostname,
const int hostlen)
netname2host (const char *netname, char *hostname, const int hostlen)
{
char *p1, *p2;