[Openvpn-devel,v5] argv: Fix one type to avoid sign-compare warning

Message ID 20260304144059.2518-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v5] argv: Fix one type to avoid sign-compare warning | expand

Commit Message

Gert Doering March 4, 2026, 2:40 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

len is already int, no need to throw another
type into the mix.

Change-Id: Ida8e587a095bdfb821ee0a4783633f026d310476
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1494
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1494
This mail reflects revision 5 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <arne-openvpn@rfc2549.org>

Comments

Gert Doering March 4, 2026, 4:48 p.m. UTC | #1
Easy enough...

Your patch has been applied to the master branch.

commit 739865d9c14723c387a777372b576984e9070678
Author: Frank Lichtenheld
Date:   Wed Mar 4 15:40:54 2026 +0100

     argv: Fix one type to avoid sign-compare warning

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1494
     Message-Id: <20260304144059.2518-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35891.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/argv.c b/src/openvpn/argv.c
index b5d9603..6a5d92e 100644
--- a/src/openvpn/argv.c
+++ b/src/openvpn/argv.c
@@ -263,11 +263,6 @@ 
     gc_free(&gc);
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /**
  *  Prepares argv format string for further processing
  *
@@ -389,7 +384,7 @@ 
      *  Do the actual vsnprintf() operation, which expands the format
      *  string with the provided arguments.
      */
-    size_t size = len + 1;
+    int size = len + 1;
     char *buf = gc_malloc(size, false, &argres->gc);
     len = vsnprintf(buf, size, f, arglist);
     if (len < 0 || len >= size)
@@ -423,10 +418,6 @@ 
     return res;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 /**
  *  printf() variant which populates a struct argv.  It processes the
  *  format string with the provided arguments.  For each space separator found