=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/client.c,v retrieving revision 1.97 retrieving revision 1.98 diff -c -r1.97 -r1.98 *** src/usr.bin/tmux/client.c 2015/10/17 18:30:43 1.97 --- src/usr.bin/tmux/client.c 2015/10/18 20:42:42 1.98 *************** *** 1,4 **** ! /* $OpenBSD: client.c,v 1.97 2015/10/17 18:30:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: client.c,v 1.98 2015/10/18 20:42:42 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 55,61 **** __dead void client_exec(const char *); int client_get_lock(char *); int client_connect(struct event_base *, char *, int); ! void client_send_identify(const char *, int); int client_write_one(enum msgtype, int, const void *, size_t); int client_write_server(enum msgtype, const void *, size_t); void client_update_event(void); --- 55,61 ---- __dead void client_exec(const char *); int client_get_lock(char *); int client_connect(struct event_base *, char *, int); ! void client_send_identify(const char *, const char *); int client_write_one(enum msgtype, int, const void *, size_t); int client_write_server(enum msgtype, const void *, size_t); void client_update_event(void); *************** *** 214,224 **** struct cmd *cmd; struct cmd_list *cmdlist; struct msg_command_data *data; ! int cmdflags, fd, i, cwd; ! const char* ttynam; pid_t ppid; enum msgtype msg; ! char *cause; struct termios tio, saved_tio; size_t size; --- 214,224 ---- struct cmd *cmd; struct cmd_list *cmdlist; struct msg_command_data *data; ! int cmdflags, fd, i; ! const char *ttynam, *cwd; pid_t ppid; enum msgtype msg; ! char *cause, path[PATH_MAX]; struct termios tio, saved_tio; size_t size; *************** *** 275,282 **** } /* Save these before pledge(). */ ! if ((cwd = open(".", O_RDONLY)) == -1) ! cwd = open("/", O_RDONLY); if ((ttynam = ttyname(STDIN_FILENO)) == NULL) ttynam = ""; --- 275,282 ---- } /* Save these before pledge(). */ ! if ((cwd = getcwd(path, sizeof path)) == NULL) ! cwd = "/"; if ((ttynam = ttyname(STDIN_FILENO)) == NULL) ttynam = ""; *************** *** 325,331 **** } /* Send identify messages. */ ! client_send_identify(ttynam, cwd); /* closes cwd */ /* Send first command. */ if (msg == MSG_COMMAND) { --- 325,331 ---- } /* Send identify messages. */ ! client_send_identify(ttynam, cwd); /* Send first command. */ if (msg == MSG_COMMAND) { *************** *** 380,386 **** /* Send identify messages to server. */ void ! client_send_identify(const char *ttynam, int cwd) { const char *s; char **ss; --- 380,386 ---- /* Send identify messages to server. */ void ! client_send_identify(const char *ttynam, const char *cwd) { const char *s; char **ss; *************** *** 395,401 **** client_write_one(MSG_IDENTIFY_TERM, -1, s, strlen(s) + 1); client_write_one(MSG_IDENTIFY_TTYNAME, -1, ttynam, strlen(ttynam) + 1); ! client_write_one(MSG_IDENTIFY_CWD, cwd, NULL, 0); if ((fd = dup(STDIN_FILENO)) == -1) fatal("dup failed"); --- 395,401 ---- client_write_one(MSG_IDENTIFY_TERM, -1, s, strlen(s) + 1); client_write_one(MSG_IDENTIFY_TTYNAME, -1, ttynam, strlen(ttynam) + 1); ! client_write_one(MSG_IDENTIFY_CWD, -1, cwd, strlen(cwd) + 1); if ((fd = dup(STDIN_FILENO)) == -1) fatal("dup failed");