summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-02-28 21:55:49 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-02-28 21:55:49 +0000
commit2fb8046a8b0b124f5f6e435af6d314298188d932 (patch)
tree0037984ad1c0faa06d49c65a6897785cde42abd8
parenta1e7b73d0c1e549b83ee50ca8642fc9511dc093f (diff)
RCS files can have a default expansion mode, keep this in mind for
update -A and -k. spotted by and ok joris
-rw-r--r--usr.bin/cvs/rcs.c5
-rw-r--r--usr.bin/cvs/update.c20
2 files changed, 15 insertions, 10 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 644bbcd1284..c88a4452fdf 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.252 2008/02/28 20:24:25 joris Exp $ */
+/* $OpenBSD: rcs.c,v 1.253 2008/02/28 21:55:48 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1478,6 +1478,9 @@ rcs_kflag_get(const char *flags)
size_t len;
const char *fp;
+ if (flags == NULL)
+ return 0;
+
fl = 0;
if (!(len = strlen(flags)))
return RCS_KWEXP_ERR;
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index da52a82a3ca..5334528444e 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.132 2008/02/11 20:33:11 tobias Exp $ */
+/* $OpenBSD: update.c,v 1.133 2008/02/28 21:55:48 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -302,9 +302,9 @@ void
cvs_update_local(struct cvs_file *cf)
{
char *tag;
- int ret, flags;
+ int ent_kflag, rcs_kflag, ret, flags;
CVSENTRIES *entlist;
- char kbuf[8], rbuf[CVS_REV_BUFSZ];
+ char rbuf[CVS_REV_BUFSZ];
cvs_log(LP_TRACE, "cvs_update_local(%s)", cf->file_path);
@@ -368,13 +368,15 @@ cvs_update_local(struct cvs_file *cf)
if (kflag)
cf->file_status = FILE_CHECKOUT;
} else {
- if (kflag) {
- (void)xsnprintf(kbuf, sizeof(kbuf),
- "-k%s", cf->file_rcs->rf_expand);
+ if (strlen(cf->file_ent->ce_opts) < 3)
+ fatal("malformed option for file %s",
+ cf->file_path);
- if (strcmp(kbuf, cf->file_ent->ce_opts))
- cf->file_status = FILE_CHECKOUT;
- } else if (reset_option)
+ ent_kflag = rcs_kflag_get(cf->file_ent->ce_opts + 2);
+ rcs_kflag = rcs_kwexp_get(cf->file_rcs);
+
+ if ((kflag && (kflag != ent_kflag)) ||
+ (reset_option && (ent_kflag != rcs_kflag)))
cf->file_status = FILE_CHECKOUT;
}
}