blob: 3d642f6383e19b9a40e453a927ccf25d275edd3b [file] [log] [blame]
--- htpdate-1.0.4-cros/htpdate.c 2011-04-07 15:58:17.000000000 -0700
+++ htpdate-1.0.4/htpdate.c 2011-04-07 21:51:53.000000000 -0700
@@ -67,6 +67,8 @@
#define URLSIZE 128
#define BUFFERSIZE 1024
+#define ERR_TIMESTAMP 0x7FFFFFFF /* Err fetching date in getHTTPdate */
+
#define sign(x) (x < 0 ? (-1) : 1)
@@ -185,7 +187,7 @@
/* Was the hostname and service resolvable? */
if ( rc ) {
printlog( 1, "%s host or service unavailable", host );
- return(0); /* Assume correct time */
+ return(ERR_TIMESTAMP);
}
/* Build a combined HTTP/1.0 and 1.1 HEAD request
@@ -218,7 +220,7 @@
if ( rc ) {
printlog( 1, "%s connection failed", host );
- return(0); /* Assume correct time */
+ return(ERR_TIMESTAMP);
}
/* Initialize timer */
@@ -303,7 +305,7 @@
if (!error)
return( timevalue.tv_sec - timeofday.tv_sec + gmtoffset );
else
- return 0;
+ return ERR_TIMESTAMP;
}
static int is_before_build_time(time_t time)
@@ -746,7 +748,9 @@
try--;
} while ( timestamp && try );
- /* Only include valid responses in timedelta[] */
+ /* Only include valid responses in timedelta[]
+ Note that ERR_TIMESTAMP explicitly can't be valid here.
+ */
if ( timestamp < timelimit && timestamp > -timelimit ) {
timedelta[validtimes] = timestamp;
validtimes++;