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:
Mariusz Zaborski 2017-05-22 20:11:40 +00:00
parent 33c6ba0c65
commit 490b79db02
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=318678

View file

@ -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);