summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/file.c
diff options
context:
space:
mode:
authorjoris <joris@openbsd.org>2005-07-29 00:33:55 +0000
committerjoris <joris@openbsd.org>2005-07-29 00:33:55 +0000
commit1c32863cf6b1b854ba645f058d28cf50973425c4 (patch)
treee508d87076b609744e5b4a5cd81f50239ecd7016 /usr.bin/cvs/file.c
parentno point in having an inode pool if we don't use it (diff)
downloadwireguard-openbsd-1c32863cf6b1b854ba645f058d28cf50973425c4.tar.xz
wireguard-openbsd-1c32863cf6b1b854ba645f058d28cf50973425c4.zip
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)