summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/tcpslice/gwtm2secs.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/tcpdump/tcpslice/gwtm2secs.c')
-rw-r--r--usr.sbin/tcpdump/tcpslice/gwtm2secs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/usr.sbin/tcpdump/tcpslice/gwtm2secs.c b/usr.sbin/tcpdump/tcpslice/gwtm2secs.c
index 249454e..f8d2e91 100644
--- a/usr.sbin/tcpdump/tcpslice/gwtm2secs.c
+++ b/usr.sbin/tcpdump/tcpslice/gwtm2secs.c
@@ -52,6 +52,13 @@ time_t gwtm2secs( struct tm *tm )
else
year += 2000;
+ /* Make sure our year is still >= 1970. We fix 3-digit years
+ * this way, because localtime(3) can return tm_year >= 100,
+ * starting in year 2000.
+ */
+ if ( year < 1970 )
+ year += 1900;
+
days = 0;
for ( i = 1970; i < year; ++i )
{
OpenPOWER on IntegriCloud