summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2007-08-30 11:07:19 +0000
committerJoris Vink <joris@cvs.openbsd.org>2007-08-30 11:07:19 +0000
commit7a688e4cd584d47e586508214a4d0a3616a75985 (patch)
treeaf3c8f5f3b878cdeb908ffabdce246850ba88dca /usr.bin
parentaa66a08bbfd64707b79d6ffa67e315138fbb2881 (diff)
properly send our log message to the server using Argumentx, so we
no longer break when the log message has multiple lines. from Tobias Stoeckmann, thanks for doing my work!
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/add.c4
-rw-r--r--usr.bin/cvs/client.c23
-rw-r--r--usr.bin/cvs/commit.c5
-rw-r--r--usr.bin/cvs/import.c4
-rw-r--r--usr.bin/cvs/logmsg.c4
-rw-r--r--usr.bin/cvs/remote.h3
6 files changed, 32 insertions, 11 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 242df4a0464..24a17c4a3c6 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.79 2007/08/29 09:32:13 joris Exp $ */
+/* $OpenBSD: add.c,v 1.80 2007/08/30 11:07:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -95,7 +95,7 @@ cvs_add(int argc, char **argv)
cvs_client_send_request("Argument %s", kbuf);
if (logmsg != NULL)
- cvs_client_send_request("Argument -m%s", logmsg);
+ cvs_client_send_logmsg(logmsg);
} else {
cr.fileproc = cvs_add_local;
}
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index b9f1bfdbe2d..25edd96c623 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.71 2007/07/17 20:29:58 xsa Exp $ */
+/* $OpenBSD: client.c,v 1.72 2007/08/30 11:07:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -377,6 +377,27 @@ cvs_client_get_responses(void)
}
void
+cvs_client_send_logmsg(char *msg)
+{
+ char *buf, *p, *q;
+
+ (void)xasprintf(&buf, "%s\n", msg);
+
+ cvs_client_send_request("Argument -m");
+ if ((p = strchr(buf, '\n')) != NULL)
+ *p++ = '\0';
+ cvs_client_send_request("Argument %s", buf);
+ for (q = p; p != NULL; q = p) {
+ if ((p = strchr(q, '\n')) != NULL) {
+ *p++ = '\0';
+ cvs_client_send_request("Argumentx %s", q);
+ }
+ }
+
+ free(buf);
+}
+
+void
cvs_client_senddir(const char *dir)
{
struct stat st;
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index afa9c6ed9a0..34a51fa3590 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.108 2007/06/28 17:45:49 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.109 2007/08/30 11:07:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -133,7 +133,8 @@ cvs_commit(int argc, char **argv)
if (!(flags & CR_RECURSE_DIRS))
cvs_client_send_request("Argument -l");
- cvs_client_send_request("Argument -m%s", logmsg);
+ if (logmsg != NULL)
+ cvs_client_send_logmsg(logmsg);
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index 5fb877f3d60..49557292cb2 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: import.c,v 1.74 2007/06/28 21:38:09 xsa Exp $ */
+/* $OpenBSD: import.c,v 1.75 2007/08/30 11:07:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -114,7 +114,7 @@ cvs_import(int argc, char **argv)
if (kflag != RCS_KWEXP_DEFAULT)
cvs_client_send_request("Argument -k%s", koptstr);
- cvs_client_send_request("Argument -m%s", logmsg);
+ cvs_client_send_logmsg(logmsg);
cvs_client_send_request("Argument %s", import_repository);
cvs_client_send_request("Argument %s", vendor_tag);
cvs_client_send_request("Argument %s", release_tag);
diff --git a/usr.bin/cvs/logmsg.c b/usr.bin/cvs/logmsg.c
index 20c4c91b28e..8ea8a86a44d 100644
--- a/usr.bin/cvs/logmsg.c
+++ b/usr.bin/cvs/logmsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logmsg.c,v 1.41 2007/05/11 02:43:24 ray Exp $ */
+/* $OpenBSD: logmsg.c,v 1.42 2007/08/30 11:07:18 joris Exp $ */
/*
* Copyright (c) 2007 Joris Vink <joris@openbsd.org>
*
@@ -69,8 +69,6 @@ cvs_logmsg_read(const char *path)
}
len = strlen(buf);
- if (len == 0)
- continue;
if (!strncmp(buf, CVS_LOGMSG_PREFIX,
strlen(CVS_LOGMSG_PREFIX)))
diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h
index 35a8e3be8c8..8be6ecd185b 100644
--- a/usr.bin/cvs/remote.h
+++ b/usr.bin/cvs/remote.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.h,v 1.24 2007/07/03 13:22:43 joris Exp $ */
+/* $OpenBSD: remote.h,v 1.25 2007/08/30 11:07:18 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -46,6 +46,7 @@ extern int server_response;
void cvs_client_connect_to_server(void);
void cvs_client_disconnect(void);
+void cvs_client_send_logmsg(char *);
void cvs_client_send_request(char *, ...);
void cvs_client_read_response(void);
void cvs_client_get_responses(void);