mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Handle empty current directory more gracefully.
This commit is contained in:
parent
72a4602b88
commit
7aeb4473ad
@ -107,6 +107,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
cp = format_expand(ft, args_get(args, 'c'));
|
||||
format_free(ft);
|
||||
|
||||
if (cp != NULL && *cp != '\0') {
|
||||
fd = open(cp, O_RDONLY|O_DIRECTORY);
|
||||
free(cp);
|
||||
if (fd == -1) {
|
||||
@ -114,6 +115,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
strerror(errno));
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
} else if (cp != NULL)
|
||||
free(cp);
|
||||
cwd = fd;
|
||||
} else if (c != NULL && c->session == NULL)
|
||||
cwd = c->cwd;
|
||||
|
@ -117,6 +117,7 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
cp = format_expand(ft, args_get(args, 'c'));
|
||||
format_free(ft);
|
||||
|
||||
if (cp != NULL && *cp != '\0') {
|
||||
fd = open(cp, O_RDONLY|O_DIRECTORY);
|
||||
free(cp);
|
||||
if (fd == -1) {
|
||||
@ -124,6 +125,8 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
strerror(errno));
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
} else if (cp != NULL)
|
||||
free(cp);
|
||||
cwd = fd;
|
||||
} else if (cmdq->client != NULL && cmdq->client->session == NULL)
|
||||
cwd = cmdq->client->cwd;
|
||||
|
@ -95,6 +95,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
cp = format_expand(ft, args_get(args, 'c'));
|
||||
format_free(ft);
|
||||
|
||||
if (cp != NULL && *cp != '\0') {
|
||||
fd = open(cp, O_RDONLY|O_DIRECTORY);
|
||||
free(cp);
|
||||
if (fd == -1) {
|
||||
@ -102,6 +103,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
strerror(errno));
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
} else if (cp != NULL)
|
||||
free(cp);
|
||||
cwd = fd;
|
||||
} else if (cmdq->client != NULL && cmdq->client->session == NULL)
|
||||
cwd = cmdq->client->cwd;
|
||||
|
Loading…
Reference in New Issue
Block a user