Util-Linux Archive mirror
 help / color / mirror / Atom feed
From: Michael Trapp <michael.trapp@sap.com>
To: util-linux@vger.kernel.org
Cc: kzak@redhat.com
Subject: [PATCH] libuuid - check clock value from LIBUUID_CLOCK_FILE
Date: Tue,  2 Aug 2022 14:16:43 +0200	[thread overview]
Message-ID: <20220802121643.29565-1-michael.trapp@sap.com> (raw)

The clock value from the LIBUUID_CLOCK_FILE must be checked in
case of an update of libuuid. If clock==CLOCK_SEQ_CONT it must
be set to a new value.
---
 libuuid/src/gen_uuid.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c
index 807dcd115..e1ba3c3d0 100644
--- a/libuuid/src/gen_uuid.c
+++ b/libuuid/src/gen_uuid.c
@@ -274,6 +274,11 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
 			last.tv_usec = tv2;
 			adjustment = a;
 		}
+		// reset in case of reserved CLOCK_SEQ_CONT
+		if (clock_seq == CLOCK_SEQ_CONT) {
+			last.tv_sec = 0;
+			last.tv_usec = 0;
+		}
 	}
 
 	if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
-- 


             reply	other threads:[~2022-08-02 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02 12:16 Michael Trapp [this message]
2022-08-22 10:28 ` [PATCH] libuuid - check clock value from LIBUUID_CLOCK_FILE Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220802121643.29565-1-michael.trapp@sap.com \
    --to=michael.trapp@sap.com \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).