Pass current directory as a string rather than a file descriptor because

pledge doesn't let us pass directory file descriptors.
This commit is contained in:
nicm
2015-10-18 20:42:42 +00:00
parent 9c601ebde8
commit 174a2ad731
3 changed files with 15 additions and 13 deletions

View File

@ -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)