mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
Fix __rpc_getconfip
__rpc_getconfip is supposed to return the first netconf entry supporting tcp or udp, respectively. The code will currently return the *last* entry, plus it will leak memory when there is more than one such entry. This change matches the reference (OpenSolaris) implementation. Tested by: David Wolfskill Obtained from: Bull GNU/linux NFSv4 Project (libtirpc) MFC after: 1 week
This commit is contained in:
parent
f3c3ef7b2a
commit
b4e7a879ab
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241142
@ -269,7 +269,8 @@ __rpc_getconfip(nettype)
|
||||
}
|
||||
while ((nconf = getnetconfig(confighandle)) != NULL) {
|
||||
if (strcmp(nconf->nc_protofmly, NC_INET) == 0) {
|
||||
if (strcmp(nconf->nc_proto, NC_TCP) == 0) {
|
||||
if (strcmp(nconf->nc_proto, NC_TCP) == 0 &&
|
||||
netid_tcp == NULL) {
|
||||
netid_tcp = strdup(nconf->nc_netid);
|
||||
if (main_thread)
|
||||
netid_tcp_main = netid_tcp;
|
||||
@ -277,7 +278,8 @@ __rpc_getconfip(nettype)
|
||||
thr_setspecific(tcp_key,
|
||||
(void *) netid_tcp);
|
||||
} else
|
||||
if (strcmp(nconf->nc_proto, NC_UDP) == 0) {
|
||||
if (strcmp(nconf->nc_proto, NC_UDP) == 0 &&
|
||||
netid_udp == NULL) {
|
||||
netid_udp = strdup(nconf->nc_netid);
|
||||
if (main_thread)
|
||||
netid_udp_main = netid_udp;
|
||||
|
Loading…
Reference in New Issue
Block a user