mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
Build format string at compile time
This commit is contained in:
parent
f8b3de041d
commit
30f3839df2
1 changed files with 3 additions and 3 deletions
|
|
@ -1502,7 +1502,9 @@ void DNS::ResolverImpl::platform_get_servers() {
|
|||
// add_dns_server() function.
|
||||
FILE *fp;
|
||||
char buf[2048], *tp;
|
||||
char fmt[32];
|
||||
#define _STR(X) #X
|
||||
#define FMT_STR_LEN(X) "%" _STR(X) "s"
|
||||
static const char fmt[] = "nameserver " FMT_STR_LEN(INET6_ADDRSTRLEN);
|
||||
char ipaddr[INET6_ADDRSTRLEN+1];
|
||||
static bool firstrun = true;
|
||||
|
||||
|
|
@ -1513,8 +1515,6 @@ void DNS::ResolverImpl::platform_get_servers() {
|
|||
return;
|
||||
}
|
||||
|
||||
Snprintf(fmt, sizeof(fmt), "nameserver %%%us", INET6_ADDRSTRLEN);
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp)) {
|
||||
tp = buf;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue