diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2020-08-21 12:34:36 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2020-08-29 13:34:41 +0200 |
| commit | 397a8a0688c0be874f0e1826ed51d88db039d769 (patch) | |
| tree | 0378c4d1f976e37be02da5a61690b3178be49509 /sam.c | |
| parent | 57a13bcea2b70c09aff2953bd0a2d451659e9bdd (diff) | |
| download | vis-397a8a0688c0be874f0e1826ed51d88db039d769.tar.gz vis-397a8a0688c0be874f0e1826ed51d88db039d769.tar.xz | |
text: provide save function taking a directory descriptor
The standard does not specify mkstempat(3). We currently implement it
in a non thread safe manner, by temporarily changing the process working
directory before invoking mkstemp(3).
Diffstat (limited to 'sam.c')
| -rw-r--r-- | sam.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -23,6 +23,7 @@ #include <errno.h> #include <unistd.h> #include <limits.h> +#include <fcntl.h> #include "sam.h" #include "vis-core.h" #include "buffer.h" @@ -1670,7 +1671,7 @@ static bool cmd_write(Vis *vis, Win *win, Command *cmd, const char *argv[], Sele if (write_entire_file) *r = text_range_new(0, text_size(text)); - TextSave *ctx = text_save_begin(text, path, file->save_method); + TextSave *ctx = text_save_begin(text, AT_FDCWD, path, file->save_method); if (!ctx) { const char *msg = errno ? strerror(errno) : "try changing `:set savemethod`"; vis_info_show(vis, "Can't write `%s': %s", path, msg); |
