summaryrefslogtreecommitdiffstats
path: root/server-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/server-client.c b/server-client.c
index 10768839..52ced4d4 100644
--- a/server-client.c
+++ b/server-client.c
@@ -1166,9 +1166,10 @@ server_client_msg_identify(struct client *c, struct imsg *imsg)
c->ttyname = xstrdup(data);
break;
case MSG_IDENTIFY_CWD:
- if (datalen != 0)
- fatalx("bad MSG_IDENTIFY_CWD size");
- c->cwd = imsg->fd;
+ 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);
break;
case MSG_IDENTIFY_STDIN:
if (datalen != 0)