diff options
| author | Chris Webb <chris@arachsys.com> | 2023-11-26 17:50:32 +0000 |
|---|---|---|
| committer | Chris Webb <chris@arachsys.com> | 2023-11-26 17:50:32 +0000 |
| commit | 05bbdb27c944f6669fdd973a3b75afdb21550298 (patch) | |
| tree | 066c78ec361845c8ab74ff581315fffec482c5e8 /src/input_handler.cc | |
| parent | 990e92a5f320953bab12ba2c0419d382cd68102e (diff) | |
Fix crash when ':write -method replace' fails to create tempfile
If a user attempts to save a file without write permission for the
containing directory, with writemethod set as 'replace' or an explicit
':write -method replace' command, kak crashes with "terminating due to
uncaught exception of type Kakoune:runtime_error". (Note this doesn't
happen with a forced write, which fails earlier when it tries to enable
u+w permission.)
Don't raise another exception when already bailing out with a runtime
error for failing to create a temporary file or open the existing file.
Instead, make a best-efforts attempt to restore the file permissions
before raising the first exception, and only report the runtime chmod
exception if that step fails on the non-error path.
Diffstat (limited to 'src/input_handler.cc')
0 files changed, 0 insertions, 0 deletions
