diff options
Diffstat (limited to 'usr.bin/cvs/diff_internals.c')
-rw-r--r-- | usr.bin/cvs/diff_internals.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/usr.bin/cvs/diff_internals.c b/usr.bin/cvs/diff_internals.c index f703e354fda..837ba9d6643 100644 --- a/usr.bin/cvs/diff_internals.c +++ b/usr.bin/cvs/diff_internals.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff_internals.c,v 1.23 2008/06/10 05:01:36 tobias Exp $ */ +/* $OpenBSD: diff_internals.c,v 1.24 2008/06/11 02:19:13 tobias Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -73,6 +73,7 @@ #include <stddef.h> #include <stdio.h> #include <string.h> +#include <time.h> #include <unistd.h> #include "cvs.h" @@ -878,19 +879,19 @@ static void diff_head(void) { char buf[64]; - struct tm *t; + struct tm t; time_t curr_time; if (diff_rev1 != NULL) { - t = gmtime(&stb1.st_mtime); + gmtime_r(&stb1.st_mtime, &t); } else { time(&curr_time); - t = localtime(&curr_time); + localtime_r(&curr_time, &t); } - (void)strftime(buf, sizeof(buf), "%b %G %H:%M:%S -0000", t); + (void)strftime(buf, sizeof(buf), "%b %G %H:%M:%S -0000", &t); diff_output("%s %s %d %s", diff_format == D_CONTEXT ? - "***" : "---", diff_file1, t->tm_mday, buf); + "***" : "---", diff_file1, t.tm_mday, buf); if (diff_rev1 != NULL) { rcsnum_tostr(diff_rev1, buf, sizeof(buf)); @@ -899,11 +900,11 @@ diff_head(void) diff_output("\n"); - t = gmtime(&stb2.st_mtime); + gmtime_r(&stb2.st_mtime, &t); - (void)strftime(buf, sizeof(buf), "%b %G %H:%M:%S -0000", t); + (void)strftime(buf, sizeof(buf), "%b %G %H:%M:%S -0000", &t); diff_output("%s %s %d %s", diff_format == D_CONTEXT ? - "---" : "+++", diff_file2, t->tm_mday, buf); + "---" : "+++", diff_file2, t.tm_mday, buf); if (diff_rev2 != NULL) { rcsnum_tostr(diff_rev2, buf, sizeof(buf)); @@ -917,37 +918,37 @@ static void rdiff_head(void) { char buf[64]; - struct tm *t; + struct tm t; time_t curr_time; if (diff_rev1 != NULL) { - t = localtime(&stb1.st_mtime); + localtime_r(&stb1.st_mtime, &t); } else { time(&curr_time); - t = localtime(&curr_time); + localtime_r(&curr_time, &t); } diff_output("%s ", diff_format == D_CONTEXT ? "***" : "---"); if (diff_rev1 == NULL) { diff_output("%s", CVS_PATH_DEVNULL); - t = gmtime(&stb1.st_atime); + gmtime_r(&stb1.st_atime, &t); } else { rcsnum_tostr(diff_rev1, buf, sizeof(buf)); diff_output("%s:%s", diff_file1, buf); } - (void)strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %G", t); + (void)strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %G", &t); diff_output("\t%s\n", buf); if (diff_rev2 != NULL) { - t = localtime(&stb2.st_mtime); + localtime_r(&stb2.st_mtime, &t); } else { time(&curr_time); - t = localtime(&curr_time); + localtime_r(&curr_time, &t); } - (void)strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %G", t); + (void)strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %G", &t); diff_output("%s %s %s\n", diff_format == D_CONTEXT ? "---" : "+++", diff_file2, buf); |