(krb5_format_time): check return value from localtime and strftime

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14248 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2004-09-21 15:47:37 +00:00
parent ef3f12c742
commit a61e4d44bd

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997-2003 Kungliga Tekniska H<>gskolan
* Copyright (c) 1997-2004 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -99,7 +99,9 @@ krb5_format_time(krb5_context context, time_t t,
tm = gmtime (&t);
else
tm = localtime(&t);
strftime(s, len, include_time ? context->time_fmt : context->date_fmt, tm);
if(tm == NULL ||
strftime(s, len, include_time ? context->time_fmt : context->date_fmt, tm) == 0)
snprintf(s, len, "%ld", (long)t);
return 0;
}