diff options
-rw-r--r-- | usr.bin/tmux/client.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 11 |
2 files changed, 9 insertions, 10 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index 4d4350186e2..0cba38d0ee9 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.3 2009/06/25 22:09:20 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.4 2009/07/22 21:58:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -36,7 +36,7 @@ void client_handle_winch(struct client_ctx *); int -client_init(char *path, struct client_ctx *cctx, int start_server, int flags) +client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) { struct sockaddr_un sa; struct stat sb; @@ -53,7 +53,7 @@ client_init(char *path, struct client_ctx *cctx, int start_server, int flags) setproctitle("client (%s)", rpathbuf); if (lstat(path, &sb) != 0) { - if (start_server && errno == ENOENT) { + if (cmdflags & CMD_STARTSERVER && errno == ENOENT) { if ((cctx->srv_fd = server_start(path)) == -1) goto start_failed; goto server_started; @@ -79,7 +79,7 @@ client_init(char *path, struct client_ctx *cctx, int start_server, int flags) if (connect( cctx->srv_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) { if (errno == ECONNREFUSED) { - if (unlink(path) != 0 || !start_server) + if (unlink(path) != 0 || !(cmdflags & CMD_STARTSERVER)) goto not_found; if ((cctx->srv_fd = server_start(path)) == -1) goto start_failed; diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 446433e5dad..da3c7ab15ec 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.19 2009/07/20 14:37:51 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.20 2009/07/22 21:58:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -213,7 +213,7 @@ main(int argc, char **argv) struct passwd *pw; char *s, *path, *label, *cause, *home, *pass = NULL; char cwd[MAXPATHLEN]; - int retcode, opt, flags, unlock, start_server; + int retcode, opt, flags, unlock, cmdflags = 0; unlock = flags = 0; label = path = NULL; @@ -390,7 +390,7 @@ main(int argc, char **argv) cmdlist = NULL; if ((pass = getpass("Password: ")) == NULL) exit(1); - start_server = 0; + cmdflags &= ~CMD_STARTSERVER; } else { if (argc == 0) { cmd = xmalloc(sizeof *cmd); @@ -407,17 +407,16 @@ main(int argc, char **argv) exit(1); } } - start_server = 0; TAILQ_FOREACH(cmd, cmdlist, qentry) { if (cmd->entry->flags & CMD_STARTSERVER) { - start_server = 1; + cmdflags |= CMD_STARTSERVER; break; } } } memset(&cctx, 0, sizeof cctx); - if (client_init(path, &cctx, start_server, flags) != 0) + if (client_init(path, &cctx, cmdflags, flags) != 0) exit(1); xfree(path); |