]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
schedule: Fix conversion warning
authorFrank Lichtenheld <frank@lichtenheld.com>
Mon, 13 Oct 2025 16:23:08 +0000 (18:23 +0200)
committerGert Doering <gert@greenie.muc.de>
Mon, 13 Oct 2025 16:27:41 +0000 (18:27 +0200)
Return value of random() is safe to cast.

Change-Id: I5e6cb3a287a2e8e1584036307b4c21bb68050c6a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1270
Message-Id: <20251013162313.2276-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59246224/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/schedule.c

index 1389889d48325cf06dc2888ecb5868863157f61f..bf6693fcd04d93a57fa9913c31828f5b0b6da8d2 100644 (file)
@@ -65,25 +65,16 @@ schedule_entry_debug_info(const char *caller, const struct schedule_entry *e)
 }
 #endif
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static inline void
 schedule_set_pri(struct schedule_entry *e)
 {
-    e->pri = random();
+    e->pri = (unsigned int)random();
     if (e->pri < 1)
     {
         e->pri = 1;
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 /* This is the master key comparison routine.  A key is
  * simply a struct timeval containing the absolute time for
  * an event.  The unique treap priority (pri) is used to ensure