[Olsr-dev] [PATCH v1 12/23] quagga: clean up invocation of olsr_exit

Ferry Huberts (spam-protected)
Fri Nov 6 16:29:04 CET 2015


From: Ferry Huberts <(spam-protected)>

olsr_exit already logs to the syslog and also prints
the message

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 lib/quagga/src/client.c | 8 ++++----
 lib/quagga/src/plugin.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/quagga/src/client.c b/lib/quagga/src/client.c
index 922db9d..dc7be84 100644
--- a/lib/quagga/src/client.c
+++ b/lib/quagga/src/client.c
@@ -41,9 +41,9 @@ my_realloc(void *buf, size_t s, const char *c)
 
   buf = realloc(buf, s);
   if (!buf) {
-    OLSR_PRINTF(1, "(QUAGGA) Out of memory: %s!\n", strerror(errno));
-    olsr_syslog(OLSR_LOG_ERR, "(QUAGGA) Out of memory!\n");
-    olsr_exit(c, EXIT_FAILURE);
+    char buf2[1024];
+    snprintf(buf2, sizeof(buf2), "QUAGGA: Out of memory (%s): %s", c, strerror(errno));
+    olsr_exit(buf2, EXIT_FAILURE);
   }
 
   return buf;
@@ -169,7 +169,7 @@ zclient_read(ssize_t * size)
     if (*size == bufsize) {
       ssize_t start = bufsize;
       bufsize += BUFSIZE;
-      buf = my_realloc(buf, bufsize, "QUAGGA: Grow read buffer");
+      buf = my_realloc(buf, bufsize, "grow read buffer");
       memset(&buf[start], 0, BUFSIZE);
     }
 
diff --git a/lib/quagga/src/plugin.c b/lib/quagga/src/plugin.c
index 1c72c76..5444245 100644
--- a/lib/quagga/src/plugin.c
+++ b/lib/quagga/src/plugin.c
@@ -37,9 +37,9 @@ static void
 
   buf = realloc(buf, s);
   if (!buf) {
-    OLSR_PRINTF(1, "(QUAGGA) Out of memory: %s!\n", strerror(errno));
-    olsr_syslog(OLSR_LOG_ERR, "(QUAGGA) Out of memory!\n");
-    olsr_exit(c, EXIT_FAILURE);
+    char buf2[1024];
+    snprintf(buf2, sizeof(buf2), "QUAGGA: Out of memory (%s): %s", c, strerror(errno));
+    olsr_exit(buf2, EXIT_FAILURE);
   }
 
   return buf;
@@ -122,7 +122,7 @@ zplugin_sockpath(const char *value, void *data __attribute__ ((unused)), set_plu
   if (set_plugin_string(value, &sockpath, addon))
     return 1;
   len = strlen(sockpath) + 1;
-  zebra.sockpath = my_realloc(zebra.sockpath, len, "QUAGGA: Grow socket path");
+  zebra.sockpath = my_realloc(zebra.sockpath, len, "grow socket path");
   memcpy(zebra.sockpath, sockpath, len);
 
   return 0;
-- 
2.5.0




More information about the Olsr-dev mailing list