diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-05-20 05:25:45 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-05-20 05:25:45 +0000 |
commit | 561194f30a306efcfc6af8bcfb5f6d14d77f31f3 (patch) | |
tree | 19eb4a88cfe6e41352cda5580e1902bbf6678ebb /usr.bin/cvs/file.c | |
parent | 92227c2873d2aa52cc72cac6ba11491f2ca43785 (diff) |
allow a cvs command to be executed from outside a repository,
ie: "cvs -d /cvs update src".
problem spotted & ok xsa@, jfb@
Diffstat (limited to 'usr.bin/cvs/file.c')
-rw-r--r-- | usr.bin/cvs/file.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index 2161d0b3688..9a0984f76c5 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.73 2005/05/20 05:13:44 joris Exp $ */ +/* $OpenBSD: file.c,v 1.74 2005/05/20 05:25:44 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -571,26 +571,24 @@ cvs_load_dirinfo(CVSFILE *cf, int flags) if (cf->cf_root == NULL) return (-1); - if (cf->cf_cvstat != CVS_FST_UNKNOWN) { - if (flags & CF_MKADMIN) - cvs_mkadmin(cf, 0755); + if (flags & CF_MKADMIN) + cvs_mkadmin(cf, 0755); - /* if the CVS administrative directory exists, load the info */ - l = snprintf(pbuf, sizeof(pbuf), "%s/" CVS_PATH_CVSDIR, fpath); - if (l == -1 || l >= (int)sizeof(pbuf)) { - errno = ENAMETOOLONG; - cvs_log(LP_ERRNO, "%s", pbuf); - return (-1); - } + /* if the CVS administrative directory exists, load the info */ + l = snprintf(pbuf, sizeof(pbuf), "%s/" CVS_PATH_CVSDIR, fpath); + if (l == -1 || l >= (int)sizeof(pbuf)) { + errno = ENAMETOOLONG; + cvs_log(LP_ERRNO, "%s", pbuf); + return (-1); + } - if ((stat(pbuf, &st) == 0) && S_ISDIR(st.st_mode)) { - if (cvs_readrepo(fpath, pbuf, sizeof(pbuf)) == 0) { - cf->cf_repo = strdup(pbuf); - if (cf->cf_repo == NULL) { - cvs_log(LP_ERRNO, - "failed to dup repository string"); - return (-1); - } + if ((stat(pbuf, &st) == 0) && S_ISDIR(st.st_mode)) { + if (cvs_readrepo(fpath, pbuf, sizeof(pbuf)) == 0) { + cf->cf_repo = strdup(pbuf); + if (cf->cf_repo == NULL) { + cvs_log(LP_ERRNO, + "failed to dup repository string"); + return (-1); } } } @@ -1062,6 +1060,10 @@ cvs_file_lget(const char *path, int flags, CVSFILE *parent, struct cvs_ent *ent) return (NULL); } + if ((cfp->cf_repo != NULL) && (cfp->cf_type == DT_DIR) && + !strcmp(cfp->cf_repo, path)) + cfp->cf_cvstat = CVS_FST_UPTODATE; + return (cfp); } |