diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2007-01-11 02:35:56 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2007-01-11 02:35:56 +0000 |
commit | 1124f9512c12c95519a730c29ad801dc4be66469 (patch) | |
tree | 21d2d1f5da9f98a462abb6bf92d13d2bf3240ec0 /usr.bin/cvs | |
parent | 64f2fea116dedf51d29d29c081c572f1d47d73a4 (diff) |
in a remote setup:
do not connect to the remote server until we are sure all the options
passed to the commands are valid.
noticed by xsa@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/add.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/admin.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/annotate.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/client.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/commit.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/diff.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/edit.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/getlog.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/init.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/remove.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/status.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/tag.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/version.c | 3 | ||||
-rw-r--r-- | usr.bin/cvs/watch.c | 4 |
16 files changed, 36 insertions, 21 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c index 24b70a3a28f..97983ac15b4 100644 --- a/usr.bin/cvs/add.c +++ b/usr.bin/cvs/add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add.c,v 1.65 2006/12/20 16:40:27 xsa Exp $ */ +/* $OpenBSD: add.c,v 1.66 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> @@ -73,6 +73,7 @@ cvs_add(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (logmsg != NULL) diff --git a/usr.bin/cvs/admin.c b/usr.bin/cvs/admin.c index e7fecb10178..c5cb0ba948e 100644 --- a/usr.bin/cvs/admin.c +++ b/usr.bin/cvs/admin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: admin.c,v 1.43 2007/01/02 00:02:17 xsa Exp $ */ +/* $OpenBSD: admin.c,v 1.44 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005 Joris Vink <joris@openbsd.org> @@ -128,6 +128,7 @@ cvs_admin(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (alist != NULL) diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c index 212ceee18ad..5e26f7a425f 100644 --- a/usr.bin/cvs/annotate.c +++ b/usr.bin/cvs/annotate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: annotate.c,v 1.32 2006/11/27 16:02:52 xsa Exp $ */ +/* $OpenBSD: annotate.c,v 1.33 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> * @@ -72,6 +72,7 @@ cvs_annotate(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (force_head == 1) diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index ccb1a0823c6..8e19a27bf69 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.44 2007/01/03 22:28:30 joris Exp $ */ +/* $OpenBSD: client.c,v 1.45 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -176,6 +176,9 @@ cvs_client_connect_to_server(void) char *cmd, *argv[9], *resp; int ifd[2], ofd[2], argc; + if (cvs_server_active == 1) + fatal("cvs_client_connect: I was already connected to server"); + switch (current_cvsroot->cr_method) { case CVS_METHOD_PSERVER: case CVS_METHOD_KSERVER: diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c index cad1b092588..1dfed2a7222 100644 --- a/usr.bin/cvs/commit.c +++ b/usr.bin/cvs/commit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commit.c,v 1.88 2007/01/07 03:08:15 joris Exp $ */ +/* $OpenBSD: commit.c,v 1.89 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -116,6 +116,7 @@ cvs_commit(int argc, char **argv) cvs_file_freelist(&files_added); if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (argc > 0) diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index 8c175eb4c32..24c2392a3d7 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,6 +1,6 @@ -/* $OpenBSD: cvs.c,v 1.112 2006/12/11 10:53:00 xsa Exp $ */ +/* $OpenBSD: cvs.c,v 1.113 2007/01/11 02:35:55 joris Exp $ */ /* - * Copyright (c) 2006 Joris Vink <joris@openbsd.org> + * Copyright (c) 2006, 2007 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. * @@ -252,10 +252,6 @@ main(int argc, char **argv) } if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { - if (cvs_server_active == 1) - fatal("remote Root while already running as server?"); - - cvs_client_connect_to_server(); cmdp->cmd(cmd_argc, cmd_argv); cvs_cleanup(); return (0); diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index 843a6f45ed3..5cc4e62b77a 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.109 2006/07/08 09:25:44 ray Exp $ */ +/* $OpenBSD: diff.c,v 1.110 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -97,6 +97,7 @@ cvs_diff(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (!(flags & CR_RECURSE_DIRS)) diff --git a/usr.bin/cvs/edit.c b/usr.bin/cvs/edit.c index 1f428d6e408..d9da8dbee12 100644 --- a/usr.bin/cvs/edit.c +++ b/usr.bin/cvs/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.26 2007/01/10 21:32:19 xsa Exp $ */ +/* $OpenBSD: edit.c,v 1.27 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006, 2007 Xavier Santolaria <xsa@openbsd.org> * @@ -116,6 +116,7 @@ cvs_edit(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (!(flags & CR_RECURSE_DIRS)) @@ -169,6 +170,7 @@ cvs_editors(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (!(flags & CR_RECURSE_DIRS)) diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c index 20c13e9b0ee..16845ca93fa 100644 --- a/usr.bin/cvs/getlog.c +++ b/usr.bin/cvs/getlog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getlog.c,v 1.68 2006/11/10 15:49:03 xsa Exp $ */ +/* $OpenBSD: getlog.c,v 1.69 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> * Copyright (c) 2006 Joris Vink <joris@openbsd.org> @@ -105,6 +105,7 @@ cvs_getlog(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (runflags & L_HEAD) diff --git a/usr.bin/cvs/init.c b/usr.bin/cvs/init.c index d3747d425ec..a42f4e46947 100644 --- a/usr.bin/cvs/init.c +++ b/usr.bin/cvs/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.26 2006/11/09 14:00:14 xsa Exp $ */ +/* $OpenBSD: init.c,v 1.27 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -82,6 +82,7 @@ cvs_init(int argc, char **argv) fatal("init does not take any extra arguments"); if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cvs_client_send_request("init %s", current_cvsroot->cr_dir); cvs_client_get_responses(); } else diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c index 4854bf475aa..6c30a5df4b5 100644 --- a/usr.bin/cvs/remove.c +++ b/usr.bin/cvs/remove.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remove.c,v 1.59 2007/01/03 22:56:54 joris Exp $ */ +/* $OpenBSD: remove.c,v 1.60 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> * @@ -78,6 +78,7 @@ cvs_remove(int argc, char **argv) cvs_file_run(1, &arg, &cr); if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (!(flags & CR_RECURSE_DIRS)) diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index 7b65e6b432f..6bf97e2534c 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.68 2006/07/07 17:37:17 joris Exp $ */ +/* $OpenBSD: status.c,v 1.69 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> @@ -88,6 +88,7 @@ cvs_status(int argc, char **argv) flags |= CR_REPO; cr.fileproc = cvs_status_local; } else { + cvs_client_connect_to_server(); if (!(flags & CR_RECURSE_DIRS)) cvs_client_send_request("Argument -l"); if (show_sym) diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c index 0a81213bf31..02127dc2856 100644 --- a/usr.bin/cvs/tag.c +++ b/usr.bin/cvs/tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tag.c,v 1.52 2006/11/09 12:51:23 xsa Exp $ */ +/* $OpenBSD: tag.c,v 1.53 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> * @@ -117,6 +117,7 @@ cvs_tag(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (runflags & T_CHECK_UPTODATE) diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index 4518dd9d987..afe1aae7124 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.81 2006/12/07 09:14:16 xsa Exp $ */ +/* $OpenBSD: update.c,v 1.82 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -103,6 +103,7 @@ cvs_update(int argc, char **argv) cr.fileproc = cvs_update_local; flags |= CR_REPO; } else { + cvs_client_connect_to_server(); if (reset_stickies) cvs_client_send_request("Argument -A"); if (build_dirs) diff --git a/usr.bin/cvs/version.c b/usr.bin/cvs/version.c index 6f865ad3388..e731847f94c 100644 --- a/usr.bin/cvs/version.c +++ b/usr.bin/cvs/version.c @@ -1,4 +1,4 @@ -/* $OpenBSD: version.c,v 1.22 2006/11/14 09:47:52 xsa Exp $ */ +/* $OpenBSD: version.c,v 1.23 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -43,6 +43,7 @@ cvs_version(int argc, char **argv) if (current_cvsroot != NULL && current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cvs_client_send_request("version"); /* XXX: better way to handle server response? */ cvs_printf("Server: "); diff --git a/usr.bin/cvs/watch.c b/usr.bin/cvs/watch.c index 5ab72ef2ea9..e6ecbee2b4a 100644 --- a/usr.bin/cvs/watch.c +++ b/usr.bin/cvs/watch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: watch.c,v 1.15 2007/01/09 17:12:14 xsa Exp $ */ +/* $OpenBSD: watch.c,v 1.16 2007/01/11 02:35:55 joris Exp $ */ /* * Copyright (c) 2005-2007 Xavier Santolaria <xsa@openbsd.org> * @@ -119,6 +119,7 @@ cvs_watch(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (watch_req & (W_ADD|W_REMOVE)) { @@ -193,6 +194,7 @@ cvs_watchers(int argc, char **argv) cr.leavedir = NULL; if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) { + cvs_client_connect_to_server(); cr.fileproc = cvs_client_sendfile; if (!(flags & CR_RECURSE_DIRS)) |