diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2008-03-01 15:10:21 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2008-03-01 15:10:21 +0000 |
commit | 9d881d07b1335fa8d04673d5a6941bcd228993a4 (patch) | |
tree | 33a30dae59dca4e0af32fa8270dfbbdc0c13eadf /usr.bin | |
parent | cbe08c5af6c7d4d6d321df486ba370f9fd075a0b (diff) |
do not overwrite CVS/Root in an existing tree whenever somebody
specified a CVSROOT using alternate ways (-d or CVSROOT environ variable)
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/util.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index f906c7f31c1..f2c10949900 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.139 2008/02/10 14:04:40 joris Exp $ */ +/* $OpenBSD: util.c,v 1.140 2008/03/01 15:10:20 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> @@ -530,13 +530,16 @@ cvs_mkadmin(const char *path, const char *root, const char *repo, if (mkdir(buf, 0755) == -1 && errno != EEXIST) fatal("cvs_mkadmin: %s: %s", buf, strerror(errno)); - (void)xsnprintf(buf, sizeof(buf), "%s/%s", path, CVS_PATH_ROOTSPEC); + if (cvs_cmdop == CVS_OP_CHECKOUT) { + (void)xsnprintf(buf, sizeof(buf), "%s/%s", + path, CVS_PATH_ROOTSPEC); - if ((fp = fopen(buf, "w")) == NULL) - fatal("cvs_mkadmin: %s: %s", buf, strerror(errno)); + if ((fp = fopen(buf, "w")) == NULL) + fatal("cvs_mkadmin: %s: %s", buf, strerror(errno)); - fprintf(fp, "%s\n", root); - (void)fclose(fp); + fprintf(fp, "%s\n", root); + (void)fclose(fp); + } (void)xsnprintf(buf, sizeof(buf), "%s/%s", path, CVS_PATH_REPOSITORY); |