+2015-01-13 Chris Allegretta <chrisa@asty.org>
+ * src/files.c (open_buffer): Check here for locking and properly
+ handle choosing to not open a file when locked instead of in
+ open_file(). Fixes Savannah bug 42373 reported by Benno Schulenberg
+
GNU nano 2.3.99pre1 - 2015.01.06
2015-01-03 Chris Allegretta <chrisa@asty.org>
* New formatter code to support syntaxes like
/* If we're loading into a new buffer, add a new entry to
* openfile. */
- if (new_buffer)
+ if (new_buffer) {
make_new_buffer();
+#ifndef NANO_TINY
+ if (ISSET(LOCKING) && filename[0] != '\0') {
+ int lockstatus = do_lockfile(filename);
+ if (lockstatus < 0) {
+ if (openfile->next) {
+ close_buffer();
+ statusbar(_("Cancelled"));
+ return;
+ } else
+ filename = "";
+ }
+ }
+#endif
+ }
+
+
/* If the filename isn't blank, and we are not in NOREAD_MODE,
* open the file. Otherwise, treat it as a new file. */
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
full_filename = mallocstrcpy(NULL, filename);
-#ifndef NANO_TINY
- if (ISSET(LOCKING)) {
- int lockstatus = do_lockfile(full_filename);
- if (lockstatus < 0)
- return -1;
- else if (lockstatus == 0)
- quiet = 1;
- }
-#endif
-
if (stat(full_filename, &fileinfo) == -1) {
/* Well, maybe we can open the file even if the OS says it's
* not there. */