Re: [Openvpn-devel] [PATCH] Print lzo_init() return code in case of errors

2018-07-13 Thread Arne Schwabe
Am 13.07.18 um 10:19 schrieb Gert Doering:
> This can help pinpointing what exactly went wrong in case of
> init failures (library version mismatch, memory issues, ...)
> 
> Signed-off-by: Gert Doering 
> ---
>  src/openvpn/lzo.c |6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
> index 8d9efea..e3be6ad 100644
> --- a/src/openvpn/lzo.c
> +++ b/src/openvpn/lzo.c
> @@ -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);
> 

ACK.

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

Ane

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH] Print lzo_init() return code in case of errors

2018-07-13 Thread Gert Doering
This can help pinpointing what exactly went wrong in case of
init failures (library version mismatch, memory issues, ...)

Signed-off-by: Gert Doering 
---
 src/openvpn/lzo.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
index 8d9efea..e3be6ad 100644
--- a/src/openvpn/lzo.c
+++ b/src/openvpn/lzo.c
@@ -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);
-- 
1.7.9.4


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel