mirror of
https://github.com/tmate-io/tmate.git
synced 2026-01-23 02:24:06 +00:00
Merge branch 'obsd-master'
Conflicts: utf8.c
This commit is contained in:
commit
35fd6d134a
4 changed files with 322 additions and 163 deletions
|
|
@ -102,11 +102,16 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
if (args_has(self->args, 'a'))
|
||||
flags = "ab";
|
||||
|
||||
xasprintf(&file, "%s/%s", cwd, path);
|
||||
if (realpath(file, resolved) == NULL)
|
||||
f = NULL;
|
||||
if (*path == '/')
|
||||
file = xstrdup(path);
|
||||
else
|
||||
f = fopen(resolved, flags);
|
||||
xasprintf(&file, "%s/%s", cwd, path);
|
||||
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);
|
||||
free(file);
|
||||
if (f == NULL) {
|
||||
cmdq_error(cmdq, "%s: %s", resolved, strerror(errno));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue