summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/file.c
diff options
context:
space:
mode:
authorjoris <joris@openbsd.org>2005-09-13 17:38:35 +0000
committerjoris <joris@openbsd.org>2005-09-13 17:38:35 +0000
commit24e99e3821899fc3a6f9f87a539e4862c48a61e1 (patch)
tree342cb03f936230eedec8048997fec649a7883b49 /usr.bin/cvs/file.c
parentlet's add directories too; testing+ok joris@. (diff)
downloadwireguard-openbsd-24e99e3821899fc3a6f9f87a539e4862c48a61e1.tar.xz
wireguard-openbsd-24e99e3821899fc3a6f9f87a539e4862c48a61e1.zip
fix conditions when the base directory should be passed to the command
callback. fixes local commands with directories as arguments (like 'add'). problem found and OK xsa@
Diffstat (limited to 'usr.bin/cvs/file.c')
-rw-r--r--usr.bin/cvs/file.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index a0e8e62bb65..b4b1bee455f 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.119 2005/09/11 14:16:48 joris Exp $ */
+/* $OpenBSD: file.c,v 1.120 2005/09/13 17:38:35 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -491,7 +491,7 @@ cvs_file_loadinfo(char *path, int flags, int (*cb)(CVSFILE *, void *),
struct cvs_ent *ent;
char *p;
char parent[MAXPATHLEN], item[MAXPATHLEN];
- int type;
+ int type, callit;
struct stat st;
struct cvsroot *root;
@@ -598,11 +598,23 @@ cvs_file_loadinfo(char *path, int flags, int (*cb)(CVSFILE *, void *),
* - the directory does not exist on disk.
* - the callback is NULL.
*/
- if (!(((cvs_cmdop == CVS_OP_SERVER) ||
- (root->cr_method == CVS_METHOD_LOCAL)) && (strcmp(path, "."))) &&
- (base->cf_flags & CVS_FILE_ONDISK) && (cb != NULL) &&
- ((cvs_error = cb(base, arg)) != CVS_EX_OK))
- goto fail;
+ callit = 1;
+ if (cb == NULL)
+ callit = 0;
+
+ if (cvs_cmdop == CVS_OP_SERVER && type != DT_DIR)
+ callit = 0;
+
+ if (root->cr_method == CVS_METHOD_LOCAL && type != DT_DIR)
+ callit = 0;
+
+ if (!(base->cf_flags & CVS_FILE_ONDISK))
+ callit = 0;
+
+ if (callit != 0) {
+ if ((cvs_error = cb(base,arg)) != CVS_EX_OK)
+ goto fail;
+ }
/*
* If we have a normal file, pass it as well.