=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.249 retrieving revision 1.250 diff -u -r1.249 -r1.250 --- src/usr.bin/tmux/server-client.c 2018/03/08 08:09:10 1.249 +++ src/usr.bin/tmux/server-client.c 2018/05/24 09:42:49 1.250 @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.249 2018/03/08 08:09:10 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.250 2018/05/24 09:42:49 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -1847,15 +1847,19 @@ /* Get client working directory. */ const char * -server_client_get_cwd(struct client *c) +server_client_get_cwd(struct client *c, struct session *s) { - struct session *s; + const char *home; if (c != NULL && c->session == NULL && c->cwd != NULL) return (c->cwd); + if (s != NULL && s->cwd != NULL) + return (s->cwd); if (c != NULL && (s = c->session) != NULL && s->cwd != NULL) return (s->cwd); - return ("."); + if ((home = find_home()) != NULL) + return (home); + return ("/"); } /* Resolve an absolute path or relative to client working directory. */ @@ -1867,7 +1871,7 @@ if (*file == '/') path = xstrdup(file); else - xasprintf(&path, "%s/%s", server_client_get_cwd(c), file); + xasprintf(&path, "%s/%s", server_client_get_cwd(c, NULL), file); if (realpath(path, resolved) == NULL) return (path); free(path);