commit 47c11ae83da877800e1bea312086f10c4acdfd94
parent 8173b1bfbe8956959df98bd0074e9290ce0112a3
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 1 Mar 2022 16:27:10 +0100
feedback: show extra warning when writing failed due to "No space left"
This mitigates https://savannah.gnu.org/bugs/?36864.
Reported-by: Clarence Risher <sparr0@gmail.com>
Problem has existed since the beginning, as nano empties the existing
file before writing the current buffer contents into it.
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -1993,6 +1993,13 @@ bool write_file(const char *name, FILE *thefile, bool normal,
statusline(ALERT, _("Error writing %s: %s"), realname, strerror(errno));
cleanup_and_exit:
+ if (errno == ENOSPC && normal) {
+ napms(3200); lastmessage = VACUUM;
+ statusline(ALERT, _("File on disk has been truncated!"));
+ napms(3200); lastmessage = VACUUM;
+ statusline(ALERT, _("Maybe ^T^Z, make room on disk, resume, then ^S^X"));
+ stat_with_alloc(realname, &openfile->statinfo);
+ }
free(tempname);
free(realname);
return FALSE;