nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 3a0ac428ba77fc5f49df3e5fcae64e1c7ca1b0e2
parent 97ab28a16455951032d7d59c55ac243bdea8ef33
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 18 Oct 2019 17:01:45 +0200

tweaks: remove a redundant check for an existing emergency file

This case is caught (by O_EXCL) later on, at the appropriate moment:
when the file is created.

Also, this removes a superfluous lstat() for each temporary file.

Diffstat:
Msrc/files.c | 7+------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -1536,11 +1536,6 @@ bool write_file(const char *name, FILE *stream, bool tmp, goto cleanup_and_exit; } #endif - - /* If the temp file exists and isn't already open, give up. */ - if (tmp && (lstat(realname, &st) != -1) && stream == NULL) - goto cleanup_and_exit; - #ifndef NANO_TINY /* Check whether the file (at the end of the symlink) exists. */ if (!tmp) @@ -1738,7 +1733,7 @@ bool write_file(const char *name, FILE *stream, bool tmp, } } - if (S_ISFIFO(st.st_mode)) + if (!tmp && S_ISFIFO(st.st_mode)) statusbar(_("Writing to FIFO...")); #endif /* !NANO_TINY */