aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog7
-rw-r--r--g10/keygen.c2
-rw-r--r--g10/keyid.c16
3 files changed, 18 insertions, 7 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index abf2084c6..e15ed8dd1 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,10 @@
+2010-10-27 Werner Koch <[email protected]>
+
+ * keygen.c (ask_expire_interval): Print 2038 warning only for 32
+ bit signed time_t.
+ * keyid.c (mk_datestr): Do the y2038 test only for a signed time_t.
+ (INVALID_TIME_CHECK): New.
+
2010-10-20 Werner Koch <[email protected]>
* encr-data.c (decode_filter): Cast -1 to size_t. Reported by
diff --git a/g10/keygen.c b/g10/keygen.c
index 760e63a08..8e396ce9b 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -1789,7 +1789,7 @@ ask_expire_interval(u32 timestamp,int object,const char *def_expire)
? _("Key expires at %s\n")
: _("Signature expires at %s\n"),
asctimestamp((ulong)(timestamp + interval) ) );
-#if SIZEOF_TIME_T <= 4
+#if SIZEOF_TIME_T <= 4 && !defined(HAVE_UNSIGNED_TIME_T)
if ((time_t)((ulong)(timestamp+interval)) < 0 )
tty_printf (_("Your system can't display dates beyond 2038.\n"
"However, it will be correctly handled up to"
diff --git a/g10/keyid.c b/g10/keyid.c
index f2657f3a5..57e9fc8e9 100644
--- a/g10/keyid.c
+++ b/g10/keyid.c
@@ -33,6 +33,14 @@
#include "keydb.h"
#include "i18n.h"
+#ifdef HAVE_UNSIGNED_TIME_T
+# define INVALID_TIME_CHECK(a) ((a) == (time_t)(-1))
+#else
+ /* Error or 32 bit time_t and value after 2038-01-19. */
+# define INVALID_TIME_CHECK(a) ((a) < 0)
+#endif
+
+
int
pubkey_letter( int algo )
{
@@ -444,12 +452,8 @@ mk_datestr (char *buffer, time_t atime)
{
struct tm *tp;
- /* Note: VMS uses an unsigned time_t thus the compiler yields a
- warning here. You may ignore this warning or def out this test
- for VMS. The proper way to handle this would be a configure
- test to a detect properly implemented unsigned time_t. */
- if ( atime < 0 ) /* 32 bit time_t and after 2038-01-19 */
- strcpy (buffer, "????" "-??" "-??"); /* mark this as invalid */
+ if (INVALID_TIME_CHECK (atime))
+ strcpy (buffer, "????" "-??" "-??"); /* Mark this as invalid. */
else {
tp = gmtime (&atime);
sprintf (buffer,"%04d-%02d-%02d",