version 1.5, 2006/11/10 14:32:44 |
version 1.6, 2006/11/28 14:49:58 |
|
|
void |
void |
cvs_repository_unlock(const char *repo) |
cvs_repository_unlock(const char *repo) |
{ |
{ |
int l; |
|
char fpath[MAXPATHLEN]; |
char fpath[MAXPATHLEN]; |
|
|
cvs_log(LP_TRACE, "cvs_repository_unlock(%s)", repo); |
cvs_log(LP_TRACE, "cvs_repository_unlock(%s)", repo); |
|
|
l = snprintf(fpath, sizeof(fpath), "%s/%s", repo, CVS_LOCK); |
if (cvs_path_cat(repo, CVS_LOCK, fpath, sizeof(fpath)) >= sizeof(fpath)) |
if (l == -1 || l >= (int)sizeof(fpath)) |
fatal("cvs_repository_unlock: truncation"); |
fatal("cvs_repository_unlock: overflow"); |
|
|
|
/* XXX - this ok? */ |
/* XXX - this ok? */ |
cvs_worklist_run(&repo_locks, cvs_worklist_unlink); |
cvs_worklist_run(&repo_locks, cvs_worklist_unlink); |
|
|
void |
void |
cvs_repository_lock(const char *repo) |
cvs_repository_lock(const char *repo) |
{ |
{ |
int l, i; |
int i; |
struct stat st; |
struct stat st; |
char fpath[MAXPATHLEN]; |
char fpath[MAXPATHLEN]; |
struct passwd *pw; |
struct passwd *pw; |
|
|
cvs_log(LP_TRACE, "cvs_repository_lock(%s)", repo); |
cvs_log(LP_TRACE, "cvs_repository_lock(%s)", repo); |
|
|
l = snprintf(fpath, sizeof(fpath), "%s/%s", repo, CVS_LOCK); |
if (cvs_path_cat(repo, CVS_LOCK, fpath, sizeof(fpath)) >= sizeof(fpath)) |
if (l == -1 || l >= (int)sizeof(fpath)) |
fatal("cvs_repository_unlock: truncation"); |
fatal("cvs_repository_lock: overflow"); |
|
|
|
for (i = 0; i < CVS_LOCK_TRIES; i++) { |
for (i = 0; i < CVS_LOCK_TRIES; i++) { |
if (cvs_quit) |
if (cvs_quit) |
|
|
cvs_repository_getdir(const char *dir, const char *wdir, |
cvs_repository_getdir(const char *dir, const char *wdir, |
struct cvs_flisthead *fl, struct cvs_flisthead *dl, int dodirs) |
struct cvs_flisthead *fl, struct cvs_flisthead *dl, int dodirs) |
{ |
{ |
int l; |
|
DIR *dirp; |
DIR *dirp; |
struct dirent *dp; |
struct dirent *dp; |
char *s, fpath[MAXPATHLEN]; |
char *s, fpath[MAXPATHLEN]; |
|
|
if (dodirs == 0 && dp->d_type == DT_DIR) |
if (dodirs == 0 && dp->d_type == DT_DIR) |
continue; |
continue; |
|
|
l = snprintf(fpath, sizeof(fpath), "%s/%s", wdir, dp->d_name); |
if (cvs_path_cat(wdir, dp->d_name, |
if (l == -1 || l >= (int)sizeof(fpath)) |
fpath, sizeof(fpath)) >= sizeof(fpath)) |
fatal("cvs_repository_getdir: overflow"); |
fatal("cvs_repository_getdir: truncation"); |
|
|
/* |
/* |
* Anticipate the file type for sorting, we do not determine |
* Anticipate the file type for sorting, we do not determine |