[2.4.18] Fix adjtimex when txc->modes == 0
PATCH 1/1 [2.4.18] Fix adjtimex when txc->modes == 0
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
kernel/time.c +3 -1
@@ -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 )