Commit faf5227b authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

files: remove a superfluous condition, and do not ignore a "No"

Having just opened a fresh buffer, 'openfile->next' will never be NULL,
because the list is circular.

Second, when compiled with --disable-nultibuffer, and deciding not to
override an existing lock, the 'return FALSE' should *not* be skipped,
because otherwise the named file will be opened after all.

This fixes an unreported bug.
No related merge requests found
Showing with 4 additions and 5 deletions
+4 -5
...@@ -456,15 +456,14 @@ bool open_buffer(const char *filename, bool undoable) ...@@ -456,15 +456,14 @@ bool open_buffer(const char *filename, bool undoable)
if (has_valid_path(realname)) { if (has_valid_path(realname)) {
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(LOCKING) && filename[0] != '\0') { if (ISSET(LOCKING) && filename[0] != '\0') {
/* When not overriding an existing lock, discard the buffer. */
if (do_lockfile(realname) < 0) { if (do_lockfile(realname) < 0) {
#ifndef DISABLE_MULTIBUFFER #ifndef DISABLE_MULTIBUFFER
if (openfile->next) {
close_buffer(); close_buffer();
#endif
free(realname); free(realname);
return FALSE; return FALSE;
} }
#endif
}
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment