]> git.gsnw.org Git - fping.git/commitdiff
Check if the variable next_value->ping_ts != 0 in seqmap_add()
authorGerman Service Network <support@gsnw.de>
Wed, 20 Mar 2024 06:31:37 +0000 (07:31 +0100)
committerDavid Schweikert <david@schweikert.ch>
Mon, 8 Apr 2024 05:12:58 +0000 (07:12 +0200)
src/seqmap.c

index 4a4e38a0a5277e918166053f9293516eeda7a1f8..62506d016dc7f85c0e7b4204bc0a6c568c5f1ee5 100644 (file)
@@ -81,7 +81,7 @@ unsigned int seqmap_add(unsigned int host_nr, unsigned int ping_count, int64_t t
     /* check if expired (note that unused seqmap values will have fields set to
      * 0, so will be seen as expired */
     next_value = &seqmap_map[seqmap_next_id];
-    if (timestamp - next_value->ping_ts < SEQMAP_TIMEOUT_IN_NS) {
+    if (next_value->ping_ts != 0 && timestamp - next_value->ping_ts < SEQMAP_TIMEOUT_IN_NS) {
         fprintf(stderr, "fping error: not enough sequence numbers available! (expire_timeout=%" PRId64 ", host_nr=%d, ping_count=%d, seqmap_next_id=%d)\n",
             SEQMAP_TIMEOUT_IN_NS, host_nr, ping_count, seqmap_next_id);
         exit(4);