diff options
author | 2015-04-04 14:19:10 +0000 | |
---|---|---|
committer | 2015-04-04 14:19:10 +0000 | |
commit | 694b1da3cf38cf8398792856a504121cfed281bb (patch) | |
tree | 31833d288f0b4a7827e854f01709cd0192728b0f | |
parent | Don't allow breaking the output line after hyphens following escape (diff) | |
download | wireguard-openbsd-694b1da3cf38cf8398792856a504121cfed281bb.tar.xz wireguard-openbsd-694b1da3cf38cf8398792856a504121cfed281bb.zip |
Fix modified timestamp in output of opencvs status.
Patch by joris via tech@; reminded by tedu
-rw-r--r-- | usr.bin/cvs/cvs.h | 3 | ||||
-rw-r--r-- | usr.bin/cvs/entries.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/status.c | 7 |
3 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index c20ecfad040..b58b259611c 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.181 2011/09/20 12:43:45 nicm Exp $ */ +/* $OpenBSD: cvs.h,v 1.182 2015/04/04 14:19:10 stsp Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -249,6 +249,7 @@ struct cvs_ent { char *ce_name; char *ce_opts; char *ce_tag; + char *ce_time; time_t ce_date; time_t ce_mtime; u_int16_t ce_type; diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c index 36fc65da695..83eb9612ca1 100644 --- a/usr.bin/cvs/entries.c +++ b/usr.bin/cvs/entries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entries.c,v 1.103 2015/01/16 06:40:07 deraadt Exp $ */ +/* $OpenBSD: entries.c,v 1.104 2015/04/04 14:19:10 stsp Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -151,6 +151,7 @@ cvs_ent_parse(const char *entry) ent->ce_rev = NULL; ent->ce_date = -1; ent->ce_tag = NULL; + ent->ce_time = NULL; if (ent->ce_type == CVS_ENT_FILE) { if (*fields[2] == '-') { @@ -187,6 +188,8 @@ cvs_ent_parse(const char *entry) if (strncmp(fields[3], "Result of merge+", 16) == 0) p += 16; + ent->ce_time = xstrdup(p); + /* Date field can be a '+=' with remote to indicate * conflict. In this case do nothing. */ if (strptime(p, "%a %b %d %T %Y", &t) != NULL) { @@ -383,6 +386,9 @@ cvs_ent_free(struct cvs_ent *ent) { if (ent->ce_rev != NULL) rcsnum_free(ent->ce_rev); + if (ent->ce_time != NULL) + xfree(ent->ce_time); + xfree(ent->ce_buf); xfree(ent); } diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index 80bc5077ab3..f5d691efd93 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.94 2015/01/16 06:40:07 deraadt Exp $ */ +/* $OpenBSD: status.c,v 1.95 2015/04/04 14:19:10 stsp Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2005-2008 Xavier Santolaria <xsa@openbsd.org> @@ -176,9 +176,8 @@ cvs_status_local(struct cvs_file *cf) rcsnum_tostr(cf->file_ent->ce_rev, revbuf, sizeof(revbuf)); if (cf->file_ent->ce_conflict == NULL) { - ctime_r(&(cf->file_ent->ce_mtime), timebuf); - if (timebuf[strlen(timebuf) - 1] == '\n') - timebuf[strlen(timebuf) - 1] = '\0'; + (void)strlcpy(timebuf, cf->file_ent->ce_time, + sizeof(timebuf)); } else { len = strlcpy(timebuf, cf->file_ent->ce_conflict, sizeof(timebuf)); |