check return value of strftime()
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: time.c,v 1.39 2001/09/05 17:03:42 gson Exp $ */
|
||||
/* $Id: time.c,v 1.40 2001/09/05 17:05:47 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -399,8 +399,11 @@ isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len) {
|
||||
REQUIRE(len > 0);
|
||||
|
||||
now = (time_t) t->seconds;
|
||||
strftime(buf, len, "%b %d %X", localtime(&now));
|
||||
flen = strlen(buf);
|
||||
snprintf(buf + flen, len - flen,
|
||||
".%03u", t->nanoseconds / 1000000);
|
||||
flen = strftime(buf, len, "%b %d %X", localtime(&now));
|
||||
INSIST(flen < len);
|
||||
if (flen != 0)
|
||||
snprintf(buf + flen, len - flen,
|
||||
".%03u", t->nanoseconds / 1000000);
|
||||
else
|
||||
snprintf(buf, len, "Bad 00 99:99:99.999");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user