summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2005-09-29 15:39:42 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2005-09-29 15:39:42 +0000
commit8782377c91b8d9711f6227e71b932d178554edd9 (patch)
tree4e876a294bce3c33fc5202c55d4e8e3d4176f1c4 /usr.bin
parentad097bd87e2f549cb7176c9bed4fa7934cfc640d (diff)
implement RCS_HEAD_REV in rcs_rev_add()
ok joris@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/rcs.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index e4be000c8f7..4f806108925 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.66 2005/09/29 15:29:20 joris Exp $ */
+/* $OpenBSD: rcs.c,v 1.67 2005/09/29 15:39:41 niallo Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1339,8 +1339,23 @@ rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date)
time_t now;
struct passwd *pw;
struct rcs_delta *rdp;
+ RCSNUM *tmprev = NULL;
if (rev == RCS_HEAD_REV) {
+ const RCSNUM *head_rev;
+ char version_str[10];
+
+ head_rev = rcs_head_get(rf);
+ if ((tmprev = rcsnum_alloc()) == NULL) {
+ cvs_log(LP_ERR, "could not allocate rcsnum");
+ return (-1);
+ }
+ if (rcsnum_cpy(head_rev, tmprev, sizeof(version_str)) != 0) {
+ cvs_log(LP_ERR, "could not perform rcsnum_cpy");
+ rcsnum_free(tmprev);
+ return (-1);
+ }
+ rev = rcsnum_inc(tmprev);
} else if ((rdp = rcs_findrev(rf, rev)) != NULL) {
rcs_errno = RCS_ERR_DUPENT;
return (-1);
@@ -1365,6 +1380,8 @@ rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date)
return (-1);
}
rcsnum_cpy(rev, rdp->rd_num, 0);
+ if (tmprev != NULL)
+ rcsnum_free(tmprev);
if ((rdp->rd_author = cvs_strdup(pw->pw_name)) == NULL) {
rcs_freedelta(rdp);