summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-11-16 00:42:34 +0100
committerThomas Graf <tgraf@suug.ch>2012-11-16 00:42:34 +0100
commit23c4ef67c735813fd41f66f6722b996d1ad7314a (patch)
treeadd54d965c816cb57d8c08ef172c7a61b007b03b
parent235aa7ff17e12ca7a76dcfd77abfe143c2ce4dea (diff)
downloadlibnl-23c4ef67c735813fd41f66f6722b996d1ad7314a.tar.gz
Use NL_DBG() instead of printing warnings and errors to stderr
Signed-off-by: Thomas Graf <tgraf@suug.ch>
-rw-r--r--include/netlink-local.h12
-rw-r--r--lib/attr.c4
-rw-r--r--lib/cache.c2
-rw-r--r--lib/cache_mngt.c8
-rw-r--r--lib/route/classid.c2
-rw-r--r--lib/utils.c2
6 files changed, 15 insertions, 15 deletions
diff --git a/include/netlink-local.h b/include/netlink-local.h
index 1f580c6..2bfae3e 100644
--- a/include/netlink-local.h
+++ b/include/netlink-local.h
@@ -86,16 +86,16 @@ struct trans_list {
fprintf(stderr, "DBG<" #LVL ">: " FMT, ##ARG); \
} while (0)
-#define BUG() \
- do { \
- fprintf(stderr, "BUG: %s:%d\n", \
- __FILE__, __LINE__); \
- assert(0); \
+#define BUG() \
+ do { \
+ NL_DBG(1, "BUG: %s:%d\n", \
+ __FILE__, __LINE__); \
+ assert(0); \
} while (0)
#define APPBUG(msg) \
do { \
- fprintf(stderr, "APPLICATION BUG: %s:%d:%s: %s\n", \
+ NL_DBG(1, "APPLICATION BUG: %s:%d:%s: %s\n", \
__FILE__, __LINE__, __PRETTY_FUNCTION__, msg); \
assert(0); \
} while(0)
diff --git a/lib/attr.c b/lib/attr.c
index a095649..1601061 100644
--- a/lib/attr.c
+++ b/lib/attr.c
@@ -253,7 +253,7 @@ int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
int type = nla_type(nla);
if (type == 0) {
- fprintf(stderr, "Illegal nla->nla_type == 0\n");
+ NL_DBG(1, "Illegal nla->nla_type == 0\n");
continue;
}
@@ -269,7 +269,7 @@ int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
}
if (rem > 0)
- fprintf(stderr, "netlink: %d bytes leftover after parsing "
+ NL_DBG(1, "netlink: %d bytes leftover after parsing "
"attributes.\n", rem);
err = 0;
diff --git a/lib/cache.c b/lib/cache.c
index 36566e0..aa17ad8 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -925,7 +925,7 @@ restart:
err = nl_cache_pickup(sk, cache);
if (err == -NLE_DUMP_INTR) {
- fprintf(stderr, "dump interrupted, restarting!\n");
+ NL_DBG(1, "dump interrupted, restarting!\n");
goto restart;
} else if (err < 0)
break;
diff --git a/lib/cache_mngt.c b/lib/cache_mngt.c
index 8f011fb..914ab9b 100644
--- a/lib/cache_mngt.c
+++ b/lib/cache_mngt.c
@@ -404,10 +404,10 @@ struct nl_cache *nl_cache_mngt_require(const char *name)
struct nl_cache *cache;
if (!(cache = __nl_cache_mngt_require(name)))
- fprintf(stderr, "Application BUG: Your application must "
- "call nl_cache_mngt_provide() and\nprovide a valid "
- "%s cache to be used for internal lookups.\nSee the "
- " API documentation for more details.\n", name);
+ NL_DBG(1, "Application BUG: Your application must "
+ "call nl_cache_mngt_provide() and\nprovide a valid "
+ "%s cache to be used for internal lookups.\nSee the "
+ " API documentation for more details.\n", name);
return cache;
}
diff --git a/lib/route/classid.c b/lib/route/classid.c
index 87025a0..255e075 100644
--- a/lib/route/classid.c
+++ b/lib/route/classid.c
@@ -441,7 +441,7 @@ static void __init classid_init(void)
nl_init_list_head(&tbl_name[i]);
if ((err = rtnl_tc_read_classid_file()) < 0)
- fprintf(stderr, "Failed to read classid file: %s\n", nl_geterror(err));
+ NL_DBG(1, "Failed to read classid file: %s\n", nl_geterror(err));
}
static void free_map(void *map) {
diff --git a/lib/utils.c b/lib/utils.c
index b5e32c3..b434bee 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -426,7 +426,7 @@ static void __init get_psched_settings(void)
if (fscanf(fd, "%08x %08x %08x %08x",
&ns_per_usec, &ns_per_tick, &nom, &denom) != 4) {
- fprintf(stderr, "Fatal error: can not read psched settings from \"%s\". " \
+ NL_DBG(1, "Fatal error: can not read psched settings from \"%s\". " \
"Try to set TICKS_PER_USEC, PROC_NET_PSCHED or PROC_ROOT " \
"environment variables\n", name);
exit(1);