summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/resp.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-07-10 00:12:53 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-07-10 00:12:53 +0000
commit7ae674abe56e9f66b44a916e99ef89605b75274a (patch)
tree4f9546f3e6ba32415b8a4b4edf4240efd87b5c56 /usr.bin/cvs/resp.c
parenta4f67b495a2b3e0d4f67e606aba79463dfe997e3 (diff)
if the Entries file for the parent directory is already open
when receiving a Clear-sticky / Set-sticky response from the server, don't re-open it again and invalidate the open list, but instead use the already opened Entries file. solves our missing directory problem.
Diffstat (limited to 'usr.bin/cvs/resp.c')
-rw-r--r--usr.bin/cvs/resp.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c
index 7024c185575..1638221b3f5 100644
--- a/usr.bin/cvs/resp.c
+++ b/usr.bin/cvs/resp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resp.c,v 1.43 2005/07/05 12:00:45 joris Exp $ */
+/* $OpenBSD: resp.c,v 1.44 2005/07/10 00:12:52 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -440,9 +440,20 @@ cvs_resp_sticky(struct cvsroot *root, int type, char *line)
return (-1);
}
+ /*
+ * If the Entries file for the parent is already
+ * open, operate on that, instead of reopening it
+ * and invalidating the opened list.
+ */
+ if (!strcmp(subdir, cvs_resp_lastdir))
+ entf = cvs_resp_lastent;
+ else
+ entf = cvs_ent_open(subdir, O_WRONLY);
+
/* add a directory entry to the parent */
- if ((entf = cvs_ent_open(subdir, O_WRONLY)) != NULL) {
- if ((ent = cvs_ent_get(entf, CVS_FILE_NAME(cf))) == NULL) {
+ if (entf != NULL) {
+ if ((ent = cvs_ent_get(entf,
+ CVS_FILE_NAME(cf))) == NULL) {
snprintf(buf, sizeof(buf), "D/%s////",
CVS_FILE_NAME(cf));
ent = cvs_ent_parse(buf);
@@ -452,7 +463,9 @@ cvs_resp_sticky(struct cvsroot *root, int type, char *line)
else
cvs_ent_add(entf, ent);
}
- cvs_ent_close(entf);
+
+ if (strcmp(subdir, cvs_resp_lastdir))
+ cvs_ent_close(entf);
}
}