File ntp-sntp.patch of Package ntp
--- sntp/main.c 2008-10-29 17:13:22.000000000 +0100
+++ sntp/main.c 2008-10-29 17:47:39.000000000 +0100
@@ -13,7 +13,7 @@
sntp [ --help | -h | -? ] [ -v | -V | -W ]
[ -q [ -f savefile ] |
- [ { -r | -a } [ -P prompt ] [ -l lockfile ] ]
+ [ [ -F ] { -r | -a } [ -P prompt ] [ -l lockfile ] ]
[ -c count ] [ -e minerr ][ -E maxerr ]
[ -d delay | -x [ separation ] [ -f savefile ] ]
[ -4 | -6 ] [ address(es) ] ]
@@ -39,6 +39,8 @@
-a indicates that the system clock should be reset by 'adjtime'.
Naturally, this will work only if the user has enough privilege.
+ -F force time set even if the corretion is to large
+
-x indicates that the program should run as a daemon (i.e. forever), and
allow for clock drift.
@@ -181,6 +183,7 @@
operation = 0; /* Defined in header.h - see action */
const char *lockname = NULL; /* The name of the lock file */
int unprivport = 0; /* Use an unpriv port for query? */
+int force = 0;
#define COUNT_MAX 25 /* Do NOT increase this! */
#define WEEBLE_FACTOR 1.2 /* See run_server() and run_daemon() */
@@ -284,7 +287,7 @@
fprintf(stderr,"Syntax: %s [ --help | -h | -? ] [ -v | -V | -W ] \n",argv0);
fprintf(stderr," [ -q [ -f savefile ] |\n");
- fprintf(stderr," [ { -r | -a } [ -P prompt ] [ -l lockfile ] ]\n");
+ fprintf(stderr," [ [ -F ] { -r | -a } [ -P prompt ] [ -l lockfile ] ]\n");
fprintf(stderr," [ -c count ] [ -e minerr ] [ -E maxerr ]\n");
fprintf(stderr," [ -d delay | -x [ separation ] ");
fprintf(stderr,"[ -f savefile ] ]\n");
@@ -627,7 +630,7 @@
/* If the correction is large, ask for confirmation before proceeding. */
- if (absoff > prompt) {
+ if ( ! force && (absoff > prompt) ) {
if (! daemon && ftty(stdin) && ftty(stdout)) {
printf("The time correction is %.3f +/- %.3f+%.3f seconds\n",
offset,dispersion,error);
@@ -1569,6 +1572,8 @@
preferred_family(PREF_FAM_INET6);
else if (strcmp(argv[1],"-u") == 0)
++unprivport;
+ else if (strcmp(argv[1],"-F") == 0)
+ force = 1;
else if (strcmp(argv[1],"-q") == 0 && action == 0)
action = action_query;
else if (strcmp(argv[1],"-r") == 0 && action == 0)
--- sntp/socket.c 2006-12-28 13:04:08.000000000 +0100
+++ sntp/socket.c 2008-11-07 10:00:04.000000000 +0100
@@ -289,7 +289,7 @@
if (which < 0 || which >= MAX_SOCKETS || descriptors[which] < 0)
fatal(0,"socket index out of range or not open",NULL);
if (waiting > 0) {
- if (setjmp(jump_buffer)) {
+ if (sigsetjmp(jump_buffer,1)) {
if (verbose > 2)
fprintf(stderr,"Receive timed out\n");
else if (verbose > 1)