[Olsr-dev] [PATCH v1 18/23] olsr: clean up invocation of olsr_exit
Ferry Huberts
(spam-protected)
Fri Nov 6 16:29:10 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.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/olsr.c b/src/olsr.c
index a16d063..d59daae 100644
--- a/src/olsr.c
+++ b/src/olsr.c
@@ -596,10 +596,9 @@ olsr_malloc(size_t size, const char *id)
ptr = calloc(1, size);
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(id, EXIT_FAILURE);
+ char buf[1024];
+ snprintf(buf, sizeof(buf), "%s: out of memory!: %s\n", id, strerror(errno));
+ olsr_exit(buf, EXIT_FAILURE);
}
return ptr;
--
2.5.0
More information about the Olsr-dev
mailing list