summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxsa <xsa@openbsd.org>2005-09-15 17:01:10 +0000
committerxsa <xsa@openbsd.org>2005-09-15 17:01:10 +0000
commitde9ffb04625e7baacbdddb829d70f59c9a01f70b (patch)
treeb44a29d7b6329ddc94452a6378182a830ea8128b
parentadd prog2 (diff)
downloadwireguard-openbsd-de9ffb04625e7baacbdddb829d70f59c9a01f70b.tar.xz
wireguard-openbsd-de9ffb04625e7baacbdddb829d70f59c9a01f70b.zip
check in cvs_mkadmin() wether we need to create or not the
CVS/Tag file. Sync the rest of the code accordingly; OK joris@.
-rw-r--r--usr.bin/cvs/add.c6
-rw-r--r--usr.bin/cvs/checkout.c5
-rw-r--r--usr.bin/cvs/cvs.h5
-rw-r--r--usr.bin/cvs/file.c9
-rw-r--r--usr.bin/cvs/req.c5
-rw-r--r--usr.bin/cvs/resp.c4
-rw-r--r--usr.bin/cvs/util.c13
7 files changed, 30 insertions, 17 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 0bf3d3bfc6a..22ae94f4e25 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.29 2005/09/13 17:35:00 xsa Exp $ */
+/* $OpenBSD: add.c,v 1.30 2005/09/15 17:01:10 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
@@ -254,6 +254,8 @@ cvs_add_directory(CVSFILE *cf)
/* Let's see if we have any per-directory tags first */
cvs_parse_tagfile(&tag, &date, &nb);
+ /* XXX check for <dir>/CVS */
+
l = snprintf(rcsdir, sizeof(rcsdir), "%s/%s",
root->cr_dir, repo);
if (l == -1 || l >= (int)sizeof(rcsdir)) {
@@ -292,7 +294,7 @@ cvs_add_directory(CVSFILE *cf)
/* create CVS/ admin files */
if (cvs_noexec == 0)
- if (cvs_mkadmin(fpath, root->cr_str, repo) == -1)
+ if (cvs_mkadmin(fpath, root->cr_str, repo, tag, date, nb) == -1)
return (-1);
/* XXX Build the Entries line. */
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 058fc64f184..2d363684561 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.39 2005/07/25 12:05:43 xsa Exp $ */
+/* $OpenBSD: checkout.c,v 1.40 2005/09/15 17:01:10 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -204,7 +204,8 @@ cvs_checkout_pre_exec(struct cvsroot *root)
return (CVS_EX_DATA);
}
- if (cvs_mkadmin(co_mods[i], root->cr_str, co_mods[i]) < 0) {
+ if (cvs_mkadmin(co_mods[i], root->cr_str, co_mods[i],
+ NULL, NULL, 0) < 0) {
cvs_log(LP_ERR, "can't create base directory '%s'",
co_mods[i]);
return (CVS_EX_DATA);
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h
index 99b9120884c..de8e058ed78 100644
--- a/usr.bin/cvs/cvs.h
+++ b/usr.bin/cvs/cvs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.h,v 1.83 2005/09/11 14:16:48 joris Exp $ */
+/* $OpenBSD: cvs.h,v 1.84 2005/09/15 17:01:10 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -408,7 +408,8 @@ int cvs_readrepo(const char *, char *, size_t);
int cvs_modetostr(mode_t, char *, size_t);
int cvs_strtomode(const char *, mode_t *);
int cvs_splitpath(const char *, char *, size_t, char **);
-int cvs_mkadmin(const char *, const char *, const char *);
+int cvs_mkadmin(const char *, const char *, const char *, char *,
+ char *, int);
int cvs_cksum(const char *, char *, size_t);
int cvs_exec(int, char **, int []);
int cvs_getargv(const char *, char **, int);
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 1980580e6fa..be13bde9774 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.121 2005/09/14 16:32:08 joris Exp $ */
+/* $OpenBSD: file.c,v 1.122 2005/09/15 17:01:10 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -286,7 +286,8 @@ cvs_file_create(CVSFILE *parent, const char *path, u_int type, mode_t mode)
}
if (((mkdir(path, mode) == -1) && (errno != EEXIST)) ||
- (cvs_mkadmin(path, cfp->cf_root->cr_str, cfp->cf_repo) < 0)) {
+ (cvs_mkadmin(path, cfp->cf_root->cr_str, cfp->cf_repo,
+ NULL, NULL, 0) < 0)) {
cvs_file_free(cfp);
return (NULL);
}
@@ -597,7 +598,7 @@ cvs_file_loadinfo(char *path, int flags, int (*cb)(CVSFILE *, void *),
* - we are running in server or local mode and the path is not "."
* - the directory does not exist on disk.
* - the callback is NULL.
- */
+ */
callit = 1;
if (cb == NULL)
callit = 0;
@@ -803,7 +804,7 @@ cvs_load_dirinfo(CVSFILE *cf, int flags)
}
if (flags & CF_MKADMIN)
- cvs_mkadmin(fpath, cf->cf_root->cr_str, NULL);
+ cvs_mkadmin(fpath, cf->cf_root->cr_str, NULL, NULL, NULL, 0);
return (0);
}
diff --git a/usr.bin/cvs/req.c b/usr.bin/cvs/req.c
index a3cbd9cf8d7..d740df00eaa 100644
--- a/usr.bin/cvs/req.c
+++ b/usr.bin/cvs/req.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: req.c,v 1.30 2005/07/29 10:38:55 joris Exp $ */
+/* $OpenBSD: req.c,v 1.31 2005/09/15 17:01:10 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -348,7 +348,8 @@ cvs_req_directory(int reqid, char *line)
* Now, create the admin files in the top-level
* directory for the temp repo.
*/
- if (cvs_mkadmin(cvs_server_tmpdir, cvs_rootstr, repo) < 0) {
+ if (cvs_mkadmin(cvs_server_tmpdir, cvs_rootstr, repo,
+ NULL, NULL, 0) < 0) {
cvs_log(LP_ERR, "failed to create admin files");
free(repo);
return (-1);
diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c
index 686abd9030f..37fc7af7a97 100644
--- a/usr.bin/cvs/resp.c
+++ b/usr.bin/cvs/resp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resp.c,v 1.57 2005/08/19 08:28:54 xsa Exp $ */
+/* $OpenBSD: resp.c,v 1.58 2005/09/15 17:01:10 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -927,7 +927,7 @@ resp_check_dir(struct cvsroot *root, const char *dir)
strlcpy(repo, dir, sizeof(repo));
}
- if (cvs_mkadmin(dir, root->cr_str, repo) < 0)
+ if (cvs_mkadmin(dir, root->cr_str, repo, NULL, NULL, 0) < 0)
return (-1);
}
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index 0136acafeb8..bbc92f803e7 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.51 2005/09/05 19:29:42 xsa Exp $ */
+/* $OpenBSD: util.c,v 1.52 2005/09/15 17:01:10 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -419,7 +419,8 @@ cvs_freeargv(char **argv, int argc)
* Returns 0 on success, or -1 on failure.
*/
int
-cvs_mkadmin(const char *dpath, const char *rootpath, const char *repopath)
+cvs_mkadmin(const char *dpath, const char *rootpath, const char *repopath,
+ char *tag, char *date, int nb)
{
size_t l;
char path[MAXPATHLEN];
@@ -427,6 +428,9 @@ cvs_mkadmin(const char *dpath, const char *rootpath, const char *repopath)
CVSENTRIES *ef;
struct stat st;
+ cvs_log(LP_TRACE, "cvs_mkadmin(%s, %s, %s, %s, %s, %d)",
+ dpath, rootpath, repopath, tag ? tag : "", date ? date : "", nb);
+
l = cvs_path_cat(dpath, CVS_PATH_CVSDIR, path, sizeof(path));
if (l >= sizeof(path))
return (-1);
@@ -471,6 +475,9 @@ cvs_mkadmin(const char *dpath, const char *rootpath, const char *repopath)
(void)fclose(fp);
}
+ /* create CVS/Tag file (if needed) */
+ (void)cvs_write_tagfile(tag, date, nb);
+
return (0);
}
@@ -674,7 +681,7 @@ cvs_create_dir(const char *path, int create_adm, char *root, char *repo)
if (l >= sizeof(rpath))
goto done;
- if (cvs_mkadmin(d, root, rpath) < 0) {
+ if (cvs_mkadmin(d, root, rpath, NULL, NULL, 0) < 0) {
cvs_log(LP_ERR, "failed to create adm files");
goto done;
}