=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.84 retrieving revision 1.85 diff -c -r1.84 -r1.85 *** src/usr.bin/cvs/file.c 2005/06/01 14:03:14 1.84 --- src/usr.bin/cvs/file.c 2005/06/01 15:46:32 1.85 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.84 2005/06/01 14:03:14 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.85 2005/06/01 15:46:32 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 248,256 **** CVSFILE* cvs_file_create(CVSFILE *parent, const char *path, u_int type, mode_t mode) { ! int fd; int bail; ! char fp[MAXPATHLEN]; CVSFILE *cfp; CVSENTRIES *ent; --- 248,256 ---- CVSFILE* cvs_file_create(CVSFILE *parent, const char *path, u_int type, mode_t mode) { ! int fd, l; int bail; ! char fp[MAXPATHLEN], repo[MAXPATHLEN]; CVSFILE *cfp; CVSENTRIES *ent; *************** *** 258,264 **** if (cfp == NULL) return (NULL); ! bail = 0; cfp->cf_mode = mode; cfp->cf_parent = parent; --- 258,264 ---- if (cfp == NULL) return (NULL); ! bail = l = 0; cfp->cf_mode = mode; cfp->cf_parent = parent; *************** *** 287,293 **** return (NULL); } ! cfp->cf_repo = strdup(cvs_file_getpath(cfp, fp, sizeof(fp))); if (cfp->cf_repo == NULL) { cvs_file_free(cfp); return (NULL); --- 287,309 ---- return (NULL); } ! if (cvs_repo_base != NULL) { ! cvs_file_getpath(cfp, fp, sizeof(fp)); ! l = snprintf(repo, sizeof(repo), "%s/%s", cvs_repo_base, ! fp); ! } else { ! cvs_file_getpath(cfp, repo, sizeof(repo)); ! l = 0; ! } ! ! if (l == -1 || l >= (int)sizeof(repo)) { ! errno = ENAMETOOLONG; ! cvs_log(LP_ERRNO, "%s", repo); ! cvs_file_free(cfp); ! return (NULL); ! } ! ! cfp->cf_repo = strdup(repo); if (cfp->cf_repo == NULL) { cvs_file_free(cfp); return (NULL); *************** *** 403,408 **** --- 419,441 ---- base = cvs_file_lget(".", 0, NULL, NULL); if (base == NULL) return (NULL); + + /* + * fill in the repository base (needed to construct repo's in + * cvs_file_create). + */ + if (base->cf_repo != NULL) { + cvs_repo_base = strdup(base->cf_repo); + if (cvs_repo_base == NULL) { + cvs_log(LP_ERR, "failed to duplicate repository base"); + cvs_file_free(base); + if (entfile) + cvs_ent_close(entfile); + return (NULL); + } + + printf("cvs_repo_base is %s\n", cvs_repo_base); + } /* XXX - needed for some commands */ if (cb != NULL) {