=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.164 retrieving revision 1.165 diff -c -r1.164 -r1.165 *** src/usr.bin/tmux/server-client.c 2015/10/28 09:51:55 1.164 --- src/usr.bin/tmux/server-client.c 2015/10/31 08:13:58 1.165 *************** *** 1,4 **** ! /* $OpenBSD: server-client.c,v 1.164 2015/10/28 09:51:55 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server-client.c,v 1.165 2015/10/31 08:13:58 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 98,104 **** c->environ = environ_create(); c->fd = -1; ! c->cwd = -1; c->cmdq = cmdq_new(c); c->cmdq->client_exit = 1; --- 98,104 ---- c->environ = environ_create(); c->fd = -1; ! c->cwd = NULL; c->cmdq = cmdq_new(c); c->cmdq->client_exit = 1; *************** *** 194,200 **** screen_free(&c->status); free(c->title); ! close(c->cwd); evtimer_del(&c->repeat_timer); --- 194,200 ---- screen_free(&c->status); free(c->title); ! free((void *)c->cwd); evtimer_del(&c->repeat_timer); *************** *** 1099,1105 **** void server_client_dispatch_identify(struct client *c, struct imsg *imsg) { ! const char *data; size_t datalen; int flags; --- 1099,1105 ---- void server_client_dispatch_identify(struct client *c, struct imsg *imsg) { ! const char *data, *home; size_t datalen; int flags; *************** *** 1132,1139 **** case MSG_IDENTIFY_CWD: if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_IDENTIFY_CWD string"); ! if ((c->cwd = open(data, O_RDONLY)) == -1) ! c->cwd = open("/", O_RDONLY); log_debug("client %p IDENTIFY_CWD %s", c, data); break; case MSG_IDENTIFY_STDIN: --- 1132,1143 ---- case MSG_IDENTIFY_CWD: if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_IDENTIFY_CWD string"); ! if (access(data, X_OK) == 0) ! c->cwd = xstrdup(data); ! else if ((home = find_home()) != NULL) ! c->cwd = xstrdup(home); ! else ! c->cwd = xstrdup("/"); log_debug("client %p IDENTIFY_CWD %s", c, data); break; case MSG_IDENTIFY_STDIN: