mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
Replacing iterating over rootpath by strsep(3).
Submitted by: kczekirda Reviewed by: tsoome, bapt, jhb, oshogbo MFC after: 3 weeks Sponsored by: Oktawave Differential Revision: https://reviews.freebsd.org/D10726
This commit is contained in:
parent
33c6ba0c65
commit
490b79db02
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=318678
|
@ -387,16 +387,14 @@ net_print(int verbose)
|
|||
uint32_t
|
||||
net_parse_rootpath()
|
||||
{
|
||||
int i;
|
||||
n_long addr = INADDR_NONE;
|
||||
char *ptr;
|
||||
|
||||
for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++)
|
||||
if (rootpath[i] == ':')
|
||||
break;
|
||||
if (i && i != FNAME_SIZE && rootpath[i] == ':') {
|
||||
rootpath[i++] = '\0';
|
||||
addr = inet_addr(&rootpath[0]);
|
||||
bcopy(&rootpath[i], rootpath, strlen(&rootpath[i])+1);
|
||||
ptr = rootpath;
|
||||
(void)strsep(&ptr, ":");
|
||||
if (ptr != NULL) {
|
||||
addr = inet_addr(rootpath);
|
||||
bcopy(ptr, rootpath, strlen(ptr) + 1);
|
||||
}
|
||||
|
||||
return (addr);
|
||||
|
|
Loading…
Reference in a new issue