]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
otime: Remove openvpn_time()
authorFrank Lichtenheld <frank@lichtenheld.com>
Tue, 11 Aug 2026 18:44:02 +0000 (20:44 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 13 Aug 2026 06:42:17 +0000 (08:42 +0200)
Using this function seems to be more complicated
than just using now directly.

Suggested by Arne in review of cppcheck fixes.

Change-Id: I2bd5259de702fce5d4ef6926c1dee7c6e6e597d7
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1841
Message-Id: <20260811184408.3535-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg38286.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/otime.h
src/openvpn/pkcs11.c
src/openvpn/push.c

index f02cc31b4e6f9bd4199bdc982e118b47f0bd4d70..d14f01ee949bf2e31764baba9b0494c037fc7b4c 100644 (file)
@@ -93,17 +93,6 @@ update_time(void)
 #endif
 }
 
-static inline time_t
-openvpn_time(time_t *t)
-{
-    update_time();
-    if (t)
-    {
-        *t = now;
-    }
-    return now;
-}
-
 static inline void
 tv_clear(struct timeval *tv)
 {
index cfcd3725a251ef613e794f3cf3878c1142282f92..8b06fd07ea92fecd055f7c9b62f44fef49359ec5 100644 (file)
@@ -42,7 +42,8 @@
 static time_t
 __mytime(void)
 {
-    return openvpn_time(NULL);
+    update_time();
+    return now;
 }
 
 #if !defined(_WIN32)
index ce2baf23824e96160e359bd0e716deabebaaddad..97f352eb5b63750b67231646f843b5b0c2116636 100644 (file)
@@ -999,9 +999,7 @@ process_incoming_push_request(struct context *c)
     else if (tls_authentication_status(c->c2.tls_multi) == TLS_AUTHENTICATION_SUCCEEDED
              && c->c2.tls_multi->multi_state >= CAS_CONNECT_DONE)
     {
-        time_t now;
-
-        openvpn_time(&now);
+        update_time();
         if (c->c2.sent_push_reply_expiry > now)
         {
             ret = PUSH_MSG_ALREADY_REPLIED;