{
uint32_t reply;
struct keyd_stats stats;
+ char started[26]; /* ctime(3) says 26 is the necessary size */
if (keyd_do_command(KEYD_CMD_VERSION, &reply, sizeof(reply)) == -1) {
printf("Got failure asking for keyd version.\n");
return;
}
- printf("keyd running since %s", ctime(&stats.started));
+ printf("keyd running since %s", ctime_r(&stats.started, started));
printf("%d client connections received\n", stats.connects);
printf("Command statistics:\n");
struct openpgp_signedpacket_list *subkeys, bool verbose,
bool html)
{
- struct tm *created = NULL;
+ struct tm created;
time_t created_time = 0;
int type = 0;
int length = 0;
(subkeys->packet->data[2] << 16) +
(subkeys->packet->data[3] << 8) +
subkeys->packet->data[4];
- created = gmtime(&created_time);
+ gmtime_r(&created_time, &created);
switch (subkeys->packet->data[0]) {
case 2:
length,
pkalgo2char(type),
keyid,
- created->tm_year + 1900,
- created->tm_mon + 1,
- created->tm_mday);
+ created.tm_year + 1900,
+ created.tm_mon + 1,
+ created.tm_mday);
}
if (verbose) {
bool skshash, bool html)
{
struct openpgp_signedpacket_list *curuid = NULL;
- struct tm *created = NULL;
+ struct tm created;
time_t created_time = 0;
int type = 0;
int length = 0;
char buf[1024];
uint64_t keyid;
+
if (html) {
puts("<pre>");
}
(keys->publickey->data[2] << 16) +
(keys->publickey->data[3] << 8) +
keys->publickey->data[4];
- created = gmtime(&created_time);
+ gmtime_r(&created_time, &created);
switch (keys->publickey->data[0]) {
case 2:
pkalgo2char(type),
keyid,
keyid,
- created->tm_year + 1900,
- created->tm_mon + 1,
- created->tm_mday);
+ created.tm_year + 1900,
+ created.tm_mon + 1,
+ created.tm_mday);
} else {
printf("pub %5d%c/0x%016" PRIX64 " %04d/%02d/%02d ",
length,
pkalgo2char(type),
keyid,
- created->tm_year + 1900,
- created->tm_mon + 1,
- created->tm_mday);
+ created.tm_year + 1900,
+ created.tm_mon + 1,
+ created.tm_mday);
}
curuid = keys->uids;
*/
static void vflog(FILE *logfile, const char *format, va_list ap)
{
- struct tm *timestamp = NULL;
- time_t timer = 0;
+ struct tm timestamp;
+ time_t timer = 0;
timer = time(NULL);
- timestamp = localtime(&timer);
+ localtime_r(&timer, ×tamp);
fprintf(logfile, "[%02d/%02d/%4d %02d:%02d:%02d] %s[%d]: ",
- timestamp->tm_mday,
- timestamp->tm_mon + 1,
- timestamp->tm_year + 1900,
- timestamp->tm_hour,
- timestamp->tm_min,
- timestamp->tm_sec,
+ timestamp.tm_mday,
+ timestamp.tm_mon + 1,
+ timestamp.tm_year + 1900,
+ timestamp.tm_hour,
+ timestamp.tm_min,
+ timestamp.tm_sec,
(logappname == NULL) ? "" : logappname,
getpid());
vfprintf(logfile, format, ap);