diff options
| author | Maxime Coste <mawww@kakoune.org> | 2023-03-13 21:34:13 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2023-03-13 21:34:13 +1100 |
| commit | c8f682f3ad8fd65df6d7bc0f8f61f0fa841a5de0 (patch) | |
| tree | 84c4fff1ee8a3b72fcb746fe5914d81d17c19a4e /src/file.cc | |
| parent | 58ead47fb4b8b727c6a3329aef98e3d385c02cc9 (diff) | |
| parent | a5f684737ff70f9823c0d8dad31543ec9f9b93b4 (diff) | |
Merge remote-tracking branch 'krobelus/perror-on-chmod-failure'
Diffstat (limited to 'src/file.cc')
| -rw-r--r-- | src/file.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/file.cc b/src/file.cc index c7092209..a2ad279b 100644 --- a/src/file.cc +++ b/src/file.cc @@ -345,11 +345,11 @@ void write_buffer_to_file(Buffer& buffer, StringView filename, } if (force and ::chmod(zfilename, st.st_mode | S_IWUSR) < 0) - throw runtime_error("unable to change file permissions"); + throw runtime_error(format("unable to change file permissions: {}", strerror(errno))); auto restore_mode = on_scope_end([&]{ if ((force or replace) and ::chmod(zfilename, st.st_mode) < 0) - throw runtime_error("unable to restore file permissions"); + throw runtime_error(format("unable to restore file permissions: {}", strerror(errno))); }); char temp_filename[PATH_MAX]; |
