summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2007-01-03 19:27:29 +0000
committerJoris Vink <joris@cvs.openbsd.org>2007-01-03 19:27:29 +0000
commit5d393e24c366a132fc8299ea3782759230fcd21c (patch)
treea9cb49b5df7adf1143fb8c7c41555e51a587c355 /usr.bin
parent3b57861f625c1750e1ceaaab2d70db3aad24f9d2 (diff)
fix CVS_CLIENT_LOG logging, we were missing parts
which was making it very hard to correctly debug remote connections.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/client.c34
-rw-r--r--usr.bin/cvs/remote.c30
-rw-r--r--usr.bin/cvs/remote.h5
3 files changed, 36 insertions, 33 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index 9ad18a2a966..2443a40a467 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.41 2007/01/02 23:55:15 joris Exp $ */
+/* $OpenBSD: client.c,v 1.42 2007/01/03 19:27:28 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -105,8 +105,8 @@ static void cvs_client_initlog(void);
* variable is set.
*/
static int cvs_client_logon = 0;
-static int cvs_client_inlog_fd = -1;
-static int cvs_client_outlog_fd = -1;
+int cvs_client_inlog_fd = -1;
+int cvs_client_outlog_fd = -1;
int server_response = SERVER_OK;
@@ -346,34 +346,6 @@ cvs_client_read_response(void)
if (resp->hdlr == NULL)
fatal("opencvs client does not support '%s'", cmd);
- if (cvs_client_outlog_fd != -1) {
- BUF *bp;
-
- bp = cvs_buf_alloc(strlen(cmd), BUF_AUTOEXT);
-
- if (cvs_buf_append(bp, cmd, strlen(cmd)) < 0)
- fatal("cvs_client_read_response: cvs_buf_append");
-
- if (cvs_buf_append(bp,
- (data == NULL) ? "" : " ",
- (data == NULL) ? 0 : 1) < 0) {
- fatal("cvs_client_read_response: cvs_buf_append");
- }
-
- if (cvs_buf_append(bp,
- (data == NULL) ? "" : data,
- (data == NULL) ? 0 : strlen(data)) < 0) {
- fatal("cvs_client_read_response: cvs_buf_append");
- }
-
- cvs_buf_putc(bp, '\n');
-
- if (cvs_buf_write_fd(bp, cvs_client_outlog_fd) < 0)
- fatal("cvs_client_read_response: cvs_buf_write_fd");
-
- cvs_buf_free(bp);
- }
-
(*resp->hdlr)(data);
xfree(cmd);
diff --git a/usr.bin/cvs/remote.c b/usr.bin/cvs/remote.c
index 67eb6323ad9..d8a1ba4374f 100644
--- a/usr.bin/cvs/remote.c
+++ b/usr.bin/cvs/remote.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.c,v 1.4 2006/07/10 01:32:32 joris Exp $ */
+/* $OpenBSD: remote.c,v 1.5 2007/01/03 19:27:28 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -97,6 +97,23 @@ cvs_remote_input(void)
}
ldata = xstrdup(data);
+
+ if (cvs_server_active == 0 && cvs_client_outlog_fd != -1) {
+ BUF *bp;
+
+ bp = cvs_buf_alloc(strlen(ldata), BUF_AUTOEXT);
+
+ if (cvs_buf_append(bp, ldata, strlen(ldata)) < 0)
+ fatal("cvs_remote_input: cvs_buf_append");
+
+ cvs_buf_putc(bp, '\n');
+
+ if (cvs_buf_write_fd(bp, cvs_client_outlog_fd) < 0)
+ fatal("cvs_remote_input: cvs_buf_write_fd");
+
+ cvs_buf_free(bp);
+ }
+
return (ldata);
}
@@ -125,6 +142,11 @@ cvs_remote_receive_file(size_t len)
xfree(data);
}
+ if (cvs_server_active == 0 && cvs_client_outlog_fd != -1) {
+ if (cvs_buf_write_fd(bp, cvs_client_outlog_fd) < 0)
+ fatal("cvs_remote_receive_file: cvs_buf_write_fd");
+ }
+
return (bp);
}
@@ -158,6 +180,12 @@ cvs_remote_send_file(const char *path)
cvs_remote_output(buf);
bp = cvs_buf_load_fd(fd, BUF_AUTOEXT);
+
+ if (cvs_server_active == 0 && cvs_client_inlog_fd != -1) {
+ if (cvs_buf_write_fd(bp, cvs_client_inlog_fd) < 0)
+ fatal("cvs_remote_send_file: cvs_buf_write");
+ }
+
fcont = cvs_buf_release(bp);
if (fcont != NULL) {
diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h
index 3f06631c5f0..8966d72788e 100644
--- a/usr.bin/cvs/remote.h
+++ b/usr.bin/cvs/remote.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.h,v 1.15 2006/12/19 15:12:59 joris Exp $ */
+/* $OpenBSD: remote.h,v 1.16 2007/01/03 19:27:28 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -104,6 +104,9 @@ char *cvs_remote_input(void);
BUF *cvs_remote_receive_file(size_t len);
void cvs_remote_send_file(const char *);
+extern int cvs_client_inlog_fd;
+extern int cvs_client_outlog_fd;
+
extern struct cvs_req cvs_requests[];
extern struct cvs_resp cvs_responses[];