mirror of
https://github.com/tmux/tmux.git
synced 2025-01-14 20:58:53 +00:00
If realpath() fails just try the original path.
This commit is contained in:
parent
005e462e01
commit
6f3475c6c7
@ -81,8 +81,9 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
file = xstrdup(path);
|
||||
else
|
||||
xasprintf(&file, "%s/%s", cwd, path);
|
||||
if (realpath(file, resolved) == NULL) {
|
||||
cmdq_error(cmdq, "%s: %s", file, strerror(errno));
|
||||
if (realpath(file, resolved) == NULL &&
|
||||
strlcpy(resolved, file, sizeof resolved) >= sizeof resolved) {
|
||||
cmdq_error(cmdq, "%s: %s", file, strerror(ENAMETOOLONG));
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
f = fopen(resolved, "rb");
|
||||
|
@ -107,8 +107,9 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
file = xstrdup(path);
|
||||
else
|
||||
xasprintf(&file, "%s/%s", cwd, path);
|
||||
if (realpath(file, resolved) == NULL) {
|
||||
cmdq_error(cmdq, "%s: %s", file, strerror(errno));
|
||||
if (realpath(file, resolved) == NULL &&
|
||||
strlcpy(resolved, file, sizeof resolved) >= sizeof resolved) {
|
||||
cmdq_error(cmdq, "%s: %s", file, strerror(ENAMETOOLONG));
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
f = fopen(resolved, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user