All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk" <michael.kerrisk@gmx.net>
To: marcelo@conectiva.com.br, lKML <linux-kernel@vger.kernel.org>
Cc: drepper@redhat.com
Subject: [PATCH] [2.4.18] Fix adjtimex when txc->modes == 0
Date: Fri, 14 Jun 2002 11:09:22 +0200	[thread overview]
Message-ID: <3D09CEE2.5529.1100FEC@localhost> (raw)

The glibc implementation of adjtime(delta, old_delta) should return
the remaining time adjustment value from adjtimex() in old_delta if that
argument is non-NULL.  

This is broken in the case that delta is NULL (i.e., we don't want 
a change, but just to find out the current time_adjust).  The breakage
occurs because adjtime specifies txc->modes as 0 (so that no change
is made to the current offset) and in this case do_adjtimex() does not
correctly return the required information in txc->offset.  

The patch below (against 2.4.18pre10) seems to me the simplest way to 
fix the problem.

Cheers,

Michael

--- linux-2.4.18/kernel/time.c	Fri Jun 14 10:17:46 2002
+++ linux-2.4.18-adjtimex/kernel/time.c	Fri Jun 14 09:48:59 2002
@@ -357,7 +357,9 @@
 	    /* p. 24, (d) */
 		result = TIME_ERROR;
 	
-	if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
+	if (!txc->modes)
+	    txc->offset	   = time_adjust;
+	else if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
 	    txc->offset	   = save_adjust;
 	else {
 	    if (time_offset < 0)


                 reply	other threads:[~2002-06-14  9:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3D09CEE2.5529.1100FEC@localhost \
    --to=michael.kerrisk@gmx.net \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.