diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-08 21:18:24 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-08-08 21:18:24 +0000 |
commit | afc7a7f90fe800edd4702c36311f0362cff98bb9 (patch) | |
tree | 5acd53844bb7693f7253848138b6534d0e8e3ed6 /usr.bin | |
parent | 6377f357574750ffd3cc1914cf0aa1884a334730 (diff) |
Tidy function a little by using a temporary variable.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/client.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index 1d064d45dae..dbe96613bd7 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.9 2009/07/30 16:32:12 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.10 2009/08/08 21:18:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -43,7 +43,7 @@ client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) struct msg_identify_data data; struct winsize ws; size_t size; - int mode; + int fd, mode; char *name, *term; char rpathbuf[MAXPATHLEN]; @@ -53,7 +53,7 @@ client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) if (lstat(path, &sb) != 0) { if (cmdflags & CMD_STARTSERVER && errno == ENOENT) { - if ((cctx->srv_fd = server_start(path)) == -1) + if ((fd = server_start(path)) == -1) goto start_failed; goto server_started; } @@ -72,15 +72,14 @@ client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) goto not_found; } - if ((cctx->srv_fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) + if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) fatal("socket"); - if (connect( - cctx->srv_fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) { + if (connect(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) { if (errno == ECONNREFUSED) { if (unlink(path) != 0 || !(cmdflags & CMD_STARTSERVER)) goto not_found; - if ((cctx->srv_fd = server_start(path)) == -1) + if ((fd = server_start(path)) == -1) goto start_failed; goto server_started; } @@ -88,10 +87,11 @@ client_init(char *path, struct client_ctx *cctx, int cmdflags, int flags) } server_started: - if ((mode = fcntl(cctx->srv_fd, F_GETFL)) == -1) + if ((mode = fcntl(fd, F_GETFL)) == -1) fatal("fcntl failed"); - if (fcntl(cctx->srv_fd, F_SETFL, mode|O_NONBLOCK) == -1) + if (fcntl(fd, F_SETFL, mode|O_NONBLOCK) == -1) fatal("fcntl failed"); + cctx->srv_fd = fd; cctx->srv_in = buffer_create(BUFSIZ); cctx->srv_out = buffer_create(BUFSIZ); |