]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
Use NL_DBG() instead of printing warnings and errors to stderr
authorThomas Graf <tgraf@suug.ch>
Thu, 15 Nov 2012 23:42:34 +0000 (00:42 +0100)
committerThomas Graf <tgraf@suug.ch>
Thu, 15 Nov 2012 23:42:34 +0000 (00:42 +0100)
Signed-off-by: Thomas Graf <tgraf@suug.ch>
include/netlink-local.h
lib/attr.c
lib/cache.c
lib/cache_mngt.c
lib/route/classid.c
lib/utils.c

index 1f580c630c23e9754cd1cdfab0d2f8e444c4e9d9..2bfae3efdade90796c917a569c9abdd28861ae34 100644 (file)
@@ -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)
index a0956492e83387374df98fe86ae78c471e5bcc13..1601061f5a6863fac2911913efa837ba83c05ac3 100644 (file)
@@ -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;
index 36566e06ed49cd6db6fb8f062165ce71bd5f80a9..aa17ad8ad4fc559c61c528b25ffa689fca584ecf 100644 (file)
@@ -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;
index 8f011fbf167a980c37f29df732ce2f2e9d43c1ce..914ab9b067b43c929d7cc1a6e6c23056a1eb93b8 100644 (file)
@@ -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;
 }
index 87025a0014adbbfe876b39d7f23b09de89fe846a..255e0750e74db75b650008fea7ff54ac8b5ac60a 100644 (file)
@@ -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) {
index b5e32c3c2dcc61346f7819c533c1fd448eb8769d..b434bee1bb5c6ccf370b28e2900c44cd57a6c244 100644 (file)
@@ -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);