Skip to contentSkip to conversation

Print lzo_init() return code in case of errors

PATCH In review Gert Doering 2 participants 3 messages Jul 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Print lzo_init() return code in case of errors

This can help pinpointing what exactly went wrong in case of init failures (library version mismatch, memory issues, ...)

---
 src/openvpn/lzo.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/openvpn/lzo.c +4 -2
index 8d9efea..e3be6ad 100644
@@ -103,9 +103,11 @@ lzo_compress_init(struct compress_context *compctx)
     msg(D_INIT_MEDIUM, "LZO compression initializing");
     ASSERT(!(compctx->flags & COMP_F_SWAP));
     compctx->wu.lzo.wmem_size = LZO_WORKSPACE;
-    if (lzo_init() != LZO_E_OK)
+
+    int lzo_status = lzo_init();
+    if (lzo_status != LZO_E_OK)
     {
-        msg(M_FATAL, "Cannot initialize LZO compression library");
+        msg(M_FATAL, "Cannot initialize LZO compression library (lzo_init() returns %d)", lzo_status);
     }
     compctx->wu.lzo.wmem = (lzo_voidp) lzo_malloc(compctx->wu.lzo.wmem_size);
     check_malloc_return(compctx->wu.lzo.wmem);
Signature · 1 line
1.7.9.4
#1 lore raw

Am 13.07.18 um 10:19 schrieb Gert Doering:

Quoted 17 lines

This can help pinpointing what exactly went wrong in case of init failures (library version mismatch, memory issues, ...)

---
 src/openvpn/lzo.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/openvpn/lzo.c +0 -0
index 8d9efea..e3be6ad 100644
@@ -103,9 +103,11 @@ lzo_compress_init(struct compress_context *compctx)
     msg(D_INIT_MEDIUM, "LZO compression initializing");
     ASSERT(!(compctx->flags & COMP_F_SWAP));
     compctx->wu.lzo.wmem_size = LZO_WORKSPACE;

src/openvpn/lzo.c lzo_compress_init(struct compress_context *compctx) · line 113

Quoted 10 lines
src/openvpn/lzo.c +4 -2
-    if (lzo_init() != LZO_E_OK)
+
+    int lzo_status = lzo_init();
+    if (lzo_status != LZO_E_OK)
     {
-        msg(M_FATAL, "Cannot initialize LZO compression library");
+        msg(M_FATAL, "Cannot initialize LZO compression library (lzo_init() returns %d)", lzo_status);
     }
     compctx->wu.lzo.wmem = (lzo_voidp) lzo_malloc(compctx->wu.lzo.wmem_size);
     check_malloc_return(compctx->wu.lzo.wmem);

ACK.

(I have not compile tested it but it looks good enough to me that I skip that on this one.

Ane

#2 lore raw
In reply to Gert Doering

Patch has been applied to the master branch.

commit 2cf21ecfca336d19a5bf203792fb7c7fe7f4a49d

Author: Gert Doering
Date:   Fri Jul 13 10:19:51 2018 +0200
     Print lzo_init() return code in case of errors

     Signed-off-by: Gert Doering <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg17248.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering