diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2007-09-02 11:11:13 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2007-09-02 11:11:13 +0000 |
commit | d501ed3a780e93bbc31c15af68528ac3b675e69b (patch) | |
tree | 0daee291bc07eb7638759eaabe003d4541750eee /usr.bin | |
parent | 1eef332c4bb3d5c9ed75ff2d89fd267115ee278f (diff) |
Log all commands sent with cvs_remote_output(), not just
cvs_client_send_request(). Simplified logging code while at it.
OK joris@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/client.c | 18 | ||||
-rw-r--r-- | usr.bin/cvs/remote.c | 24 |
2 files changed, 11 insertions, 31 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index b33a400e025..8e44dd10ee6 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.73 2007/09/01 15:41:34 joris Exp $ */ +/* $OpenBSD: client.c,v 1.74 2007/09/02 11:11:12 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -325,22 +325,6 @@ cvs_client_send_request(char *fmt, ...) cvs_log(LP_TRACE, "%s", data); - if (cvs_client_inlog_fd != -1) { - BUF *bp; - - bp = cvs_buf_alloc(strlen(data), BUF_AUTOEXT); - - if (cvs_buf_append(bp, data, strlen(data)) < 0) - fatal("cvs_client_send_request: cvs_buf_append"); - - cvs_buf_putc(bp, '\n'); - - if (cvs_buf_write_fd(bp, cvs_client_inlog_fd) < 0) - fatal("cvs_client_send_request: cvs_buf_write_fd"); - - cvs_buf_free(bp); - } - cvs_remote_output(data); xfree(data); } diff --git a/usr.bin/cvs/remote.c b/usr.bin/cvs/remote.c index 63bb416478c..e90b62ab8d9 100644 --- a/usr.bin/cvs/remote.c +++ b/usr.bin/cvs/remote.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.c,v 1.15 2007/05/16 19:40:45 xsa Exp $ */ +/* $OpenBSD: remote.c,v 1.16 2007/09/02 11:11:12 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -56,6 +56,7 @@ void cvs_remote_output(const char *data) { FILE *out; + char nl = '\n'; if (cvs_server_active) out = stdout; @@ -64,6 +65,11 @@ cvs_remote_output(const char *data) fputs(data, out); fputs("\n", out); + + if (cvs_server_active == 0 && cvs_client_inlog_fd != -1) { + (void)write(cvs_client_inlog_fd, data, strlen(data)); + (void)write(cvs_client_inlog_fd, &nl, 1); + } } char * @@ -71,6 +77,7 @@ cvs_remote_input(void) { FILE *in; size_t len; + char nl = '\n'; char *data, *ldata; if (cvs_server_active) @@ -101,19 +108,8 @@ cvs_remote_input(void) } 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); + (void)write(cvs_client_outlog_fd, data, strlen(data)); + (void)write(cvs_client_outlog_fd, &nl, 1); } return (ldata); |