nano

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

commit 38c5a4465b631374f4aba53c493fbcc593eef729
parent f494bfcbb996a26765aab2e436a55ccdfe9252a6
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Thu, 30 Jan 2020 19:21:28 +0100

tweaks: reshuffle some assignments for a return value

Diffstat:
Msrc/files.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -304,7 +304,7 @@ int do_lockfile(const char *filename, bool ask_the_user) strlen(locking_suffix) + 3; char *lockfilename = charalloc(locknamesize); struct stat fileinfo; - int retval = -1; + int retval = 0; snprintf(lockfilename, locknamesize, "%s/%s%s%s", dirname(namecopy), locking_prefix, basename(secondcopy), locking_suffix); @@ -322,7 +322,6 @@ int do_lockfile(const char *filename, bool ask_the_user) if ((lockfd = open(lockfilename, O_RDONLY)) < 0) { statusline(ALERT, _("Error opening lock file %s: %s"), lockfilename, strerror(errno)); - retval = 0; goto free_the_name; } @@ -337,7 +336,6 @@ int do_lockfile(const char *filename, bool ask_the_user) if (readtot < 1024 || lockbuf[0] != 0x62 || lockbuf[1] != 0x30) { statusline(ALERT, _("Bad lock file is ignored: %s"), lockfilename); free(lockbuf); - retval = 0; goto free_the_name; } @@ -380,6 +378,7 @@ int do_lockfile(const char *filename, bool ask_the_user) free(promptstr); if (choice < 1) { + retval = -1; wipe_statusbar(); goto free_the_name; }