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 git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5104 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
69429ce274
Коммит
6948d2e779
@ -1,3 +1,8 @@
|
|||||||
|
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
|
GNU nano 2.3.99pre1 - 2015.01.06
|
||||||
2015-01-03 Chris Allegretta <chrisa@asty.org>
|
2015-01-03 Chris Allegretta <chrisa@asty.org>
|
||||||
* New formatter code to support syntaxes like
|
* New formatter code to support syntaxes like
|
||||||
|
28
src/files.c
28
src/files.c
@ -337,9 +337,25 @@ void open_buffer(const char *filename, bool undoable)
|
|||||||
|
|
||||||
/* If we're loading into a new buffer, add a new entry to
|
/* If we're loading into a new buffer, add a new entry to
|
||||||
* openfile. */
|
* openfile. */
|
||||||
if (new_buffer)
|
if (new_buffer) {
|
||||||
make_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,
|
/* If the filename isn't blank, and we are not in NOREAD_MODE,
|
||||||
* open the file. Otherwise, treat it as a new file. */
|
* open the file. Otherwise, treat it as a new file. */
|
||||||
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
|
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
|
||||||
@ -906,16 +922,6 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
|||||||
full_filename = mallocstrcpy(NULL, filename);
|
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) {
|
if (stat(full_filename, &fileinfo) == -1) {
|
||||||
/* Well, maybe we can open the file even if the OS says it's
|
/* Well, maybe we can open the file even if the OS says it's
|
||||||
* not there. */
|
* not there. */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user