[Olsr-dev] [PATCH v1 14/23] cookie: clean up invocation of olsr_exit

Ferry Huberts (spam-protected)
Fri Nov 6 16:29:06 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)>
---
 src/olsr_cookie.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/olsr_cookie.c b/src/olsr_cookie.c
index 0444082..ac31dab 100644
--- a/src/olsr_cookie.c
+++ b/src/olsr_cookie.c
@@ -231,10 +231,9 @@ olsr_cookie_malloc(struct olsr_cookie_info *ci)
     ptr = calloc(1, ci->ci_size + sizeof(struct olsr_cookie_mem_brand));
 
     if (!ptr) {
-      const char *const err_msg = strerror(errno);
-      OLSR_PRINTF(1, "OUT OF MEMORY: %s\n", err_msg);
-      olsr_syslog(OLSR_LOG_ERR, "olsrd: out of memory!: %s\n", err_msg);
-      olsr_exit(ci->ci_name, EXIT_FAILURE);
+      char buf[1024];
+      snprintf(buf, sizeof(buf), "%s: out of memory: %s", ci->ci_name, strerror(errno));
+      olsr_exit(buf, EXIT_FAILURE);
     }
     assert(ptr);
   } else {
-- 
2.5.0




More information about the Olsr-dev mailing list