mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
add threadsafe version of inet_ntoa (inet_ntoa_r takes a buffer to fill)
this is used by some debugging functions
This commit is contained in:
parent
d28632c097
commit
ed0fe1449c
1 changed files with 14 additions and 0 deletions
|
|
@ -48,3 +48,17 @@ inet_ntoa(struct in_addr ina)
|
|||
return buf;
|
||||
}
|
||||
|
||||
char *
|
||||
inet_ntoa_r(struct in_addr ina, char *buf)
|
||||
{
|
||||
unsigned char *ucp = (unsigned char *)&ina;
|
||||
|
||||
sprintf(buf, "%d.%d.%d.%d",
|
||||
ucp[0] & 0xff,
|
||||
ucp[1] & 0xff,
|
||||
ucp[2] & 0xff,
|
||||
ucp[3] & 0xff);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue