mirror of
https://github.com/nmap/nmap.git
synced 2026-11-18 17:11:18 +08:00
Mark log functions as printf-like
This commit is contained in:
@@ -384,6 +384,8 @@ protected:
|
||||
};
|
||||
|
||||
static void null_status_cb(const DNS::Stats *stat) { (void) stat; }
|
||||
static void null_log_func(int lvl, const char *s, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
static void null_log_func(int lvl, const char *s, ...) { (void) lvl; (void) s; }
|
||||
|
||||
namespace DNS {
|
||||
@@ -474,7 +476,7 @@ private:
|
||||
Stats stat;
|
||||
int *read_timeouts;
|
||||
void (*status_cb)(const Stats *);
|
||||
void (*log_func)(int lvl, const char *, ...);
|
||||
Resolver::log_func_t log_func;
|
||||
|
||||
void init_host_cache();
|
||||
void platform_get_servers();
|
||||
@@ -554,7 +556,7 @@ void DNS::Resolver::setStatusCallback(void (*callback)(const DNS::Stats *))
|
||||
impl->status_cb = callback;
|
||||
}
|
||||
|
||||
void DNS::Resolver::setLogFunc(void (*log_func)(int lvl, const char *, ...))
|
||||
void DNS::Resolver::setLogFunc(log_func_t log_func)
|
||||
{
|
||||
impl->log_func = log_func;
|
||||
}
|
||||
|
||||
@@ -284,7 +284,9 @@ public:
|
||||
|
||||
void setAF(int af);
|
||||
void setStatusCallback(void (*callback)(const Stats *));
|
||||
void setLogFunc(void (*log_func)(int lvl, const char *, ...));
|
||||
typedef void (*log_func_t)(int lvl, const char *, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
void setLogFunc(log_func_t log_func);
|
||||
void setSource(const char *device, const struct sockaddr_storage *src, size_t srclen, bool spoof);
|
||||
void setIpOptions(const u8 *opts, size_t optslen);
|
||||
void setProxyChain(const nsock_proxychain proxy_chain);
|
||||
|
||||
+2
-1
@@ -554,7 +554,8 @@ char *executable_path(const char *argv0);
|
||||
/* A set of addresses. Used to match against allow/deny lists. */
|
||||
struct addrset;
|
||||
|
||||
void nbase_set_log(void (*log_user_func)(const char *, ...),void (*log_debug_func)(const char *, ...));
|
||||
typedef void (*nbase_log_t) (const char *, ...) __attribute__((format(printf, 1, 2)));
|
||||
void nbase_set_log(nbase_log_t log_user_func, nbase_log_t log_debug_func);
|
||||
struct addrset *addrset_new();
|
||||
extern void addrset_free(struct addrset *set);
|
||||
extern void addrset_print(FILE *fp, const struct addrset *set);
|
||||
|
||||
@@ -70,15 +70,17 @@
|
||||
/* A fancy logging system to allow this file to take advantage of different logging
|
||||
systems used by various programs */
|
||||
|
||||
static void default_log_user(const char * a, ...){};
|
||||
static void default_log_user(const char * a, ...)
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
static void default_log_user(const char * a, ...) { (void) a; }
|
||||
static void default_log_debug(const char * a, ...)
|
||||
__attribute__((format(printf, 1, 2)));
|
||||
static void default_log_debug(const char * a, ...) { (void) a; }
|
||||
|
||||
static void (*log_user)(const char *, ...) = default_log_user;
|
||||
nbase_log_t log_user = default_log_user;
|
||||
nbase_log_t log_debug = default_log_debug;
|
||||
|
||||
static void default_log_debug(const char * a, ...){};
|
||||
|
||||
static void (*log_debug)(const char *, ...) = default_log_debug;
|
||||
|
||||
void nbase_set_log(void (*log_user_func)(const char *, ...),void (*log_debug_func)(const char *, ...)){
|
||||
void nbase_set_log(nbase_log_t log_user_func, nbase_log_t log_debug_func) {
|
||||
if (log_user_func == NULL)
|
||||
log_user = default_log_user;
|
||||
else
|
||||
|
||||
@@ -70,6 +70,8 @@ extern NmapOps o;
|
||||
|
||||
static ScanProgressMeter *SPM = NULL;
|
||||
|
||||
void nmap_massdns_log(int lvl, const char *fmt, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
void nmap_massdns_log(int lvl, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
Reference in New Issue
Block a user