summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/file.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-07-29 00:33:56 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-07-29 00:33:56 +0000
commitc13e74faf0e3b2720bac52ed6b34e955c6c355d8 (patch)
tree6b0b3825a7b8ece2abd827ebaecc41591fcd6a9f /usr.bin/cvs/file.c
parent896fdf99616b859a4533cb7e05b6d23c3304b8a0 (diff)
correctly build the repository path in cvs_load_dirinfo() so we do not
end up with a totally messed up repopath when there are no admin files present. problems reported by mpech@ and Nuno Margadinho. tested by Nuno Margadinho, thanks a lot!
Diffstat (limited to 'usr.bin/cvs/file.c')
-rw-r--r--usr.bin/cvs/file.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 8284525b87a..f1946e1a986 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.106 2005/07/27 10:36:14 xsa Exp $ */
+/* $OpenBSD: file.c,v 1.107 2005/07/29 00:33:55 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -781,16 +781,19 @@ cvs_load_dirinfo(CVSFILE *cf, int flags)
/*
* Fill in the repo path ourselfs.
*/
- l = snprintf(pbuf, sizeof(pbuf), "%s/%s",
- cvs_repo_base, fpath);
- if (l == -1 || l >= (int)sizeof(pbuf))
- return (-1);
+ if (cvs_repo_base != NULL) {
+ l = snprintf(pbuf, sizeof(pbuf), "%s/%s",
+ cvs_repo_base, fpath);
+ if (l == -1 || l >= (int)sizeof(pbuf))
+ return (-1);
- cf->cf_repo = strdup(pbuf);
- if (cf->cf_repo == NULL) {
- cvs_log(LP_ERRNO, "failed to dup repo string");
- return (-1);
- }
+ cf->cf_repo = strdup(pbuf);
+ if (cf->cf_repo == NULL) {
+ cvs_log(LP_ERRNO, "failed to dup repo string");
+ return (-1);
+ }
+ } else
+ cf->cf_repo = NULL;
}
if (flags & CF_MKADMIN)