diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-08-03 04:41:20 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-08-03 04:41:20 +0000 |
commit | a0f26bf514f13ad7bfd75529410888cbd4bc947d (patch) | |
tree | df13395475d066ded1a6ea60fbdb878c3f9c3c73 | |
parent | c2f6aed890b7f1d9b603ab367906d15348cef733 (diff) |
Fix an annoying error message on checkouts by loading administrative
information from the CVS Entries, Root and Repository files if the
CVS directory exists
-rw-r--r-- | usr.bin/cvs/file.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 52a8c896b43..ab61c5a2ff9 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.19 2004/08/03 04:28:15 jfb Exp $ */ +/* $OpenBSD: file.c,v 1.20 2004/08/03 04:41:19 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -364,6 +364,7 @@ cvs_file_getdir(CVSFILE *cf, int flags) char fbuf[2048], pbuf[MAXPATHLEN]; struct dirent *ent; CVSFILE *cfp; + struct stat st; struct cvs_dir *cdp; struct cvs_flist dirs; @@ -371,14 +372,6 @@ cvs_file_getdir(CVSFILE *cf, int flags) TAILQ_INIT(&dirs); cdp = cf->cf_ddat; - if (cvs_readrepo(cf->cf_path, pbuf, sizeof(pbuf)) == 0) { - cdp->cd_repo = strdup(pbuf); - if (cdp->cd_repo == NULL) { - free(cdp); - return (-1); - } - } - cdp->cd_root = cvsroot_get(cf->cf_path); if (cdp->cd_root == NULL) { cvs_file_freedir(cdp); @@ -388,7 +381,19 @@ cvs_file_getdir(CVSFILE *cf, int flags) if (flags & CF_MKADMIN) cvs_mkadmin(cf, 0755); - cdp->cd_ent = cvs_ent_open(cf->cf_path, O_RDONLY); + /* if the CVS administrative directory exists, load the info */ + snprintf(pbuf, sizeof(pbuf), "%s/" CVS_PATH_CVSDIR, cf->cf_path); + if ((stat(pbuf, &st) == 0) && S_ISDIR(st.st_mode)) { + if (cvs_readrepo(cf->cf_path, pbuf, sizeof(pbuf)) == 0) { + cdp->cd_repo = strdup(pbuf); + if (cdp->cd_repo == NULL) { + free(cdp); + return (-1); + } + } + + cdp->cd_ent = cvs_ent_open(cf->cf_path, O_RDONLY); + } fd = open(cf->cf_path, O_RDONLY); if (fd == -1) { |