Commit 76c25f58 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

still more breakage fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2837 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 12 additions and 5 deletions
+12 -5
...@@ -20,6 +20,11 @@ CVS code - ...@@ -20,6 +20,11 @@ CVS code -
switch_to_prev_buffer(), rename open_nextfile_void() switch_to_prev_buffer(), rename open_nextfile_void()
switch_to_next_buffer(), remove load_file(), and remove switch_to_next_buffer(), remove load_file(), and remove
load_open_file(). (DLR) load_open_file(). (DLR)
- files.c:
open_file()
- Assert that filename isn't NULL, and don't do anything special
if it's blank, as the the former case shouldn't occur, and the
latter case is now handled elsewhere. (DLR)
- global.c: - global.c:
shortcut_init() shortcut_init()
- Simplify wording of nano_gotoline_msg. (Jordi) - Simplify wording of nano_gotoline_msg. (Jordi)
......
...@@ -157,6 +157,8 @@ void open_buffer(const char *filename) ...@@ -157,6 +157,8 @@ void open_buffer(const char *filename)
/* rc == -2 means that we have a new file. -1 means that the /* rc == -2 means that we have a new file. -1 means that the
* open() failed. 0 means that the open() succeeded. */ * open() failed. 0 means that the open() succeeded. */
assert(filename != NULL);
#ifndef DISABLE_OPERATINGDIR #ifndef DISABLE_OPERATINGDIR
if (check_operating_dir(filename, FALSE)) { if (check_operating_dir(filename, FALSE)) {
statusbar(_("Can't insert file from outside of %s"), statusbar(_("Can't insert file from outside of %s"),
...@@ -165,7 +167,8 @@ void open_buffer(const char *filename) ...@@ -165,7 +167,8 @@ void open_buffer(const char *filename)
} }
#endif #endif
/* Open the file. */ /* If the filename isn't blank, open the file. */
if (filename[0] != '\0')
rc = open_file(filename, new_buffer, &f); rc = open_file(filename, new_buffer, &f);
/* If we're loading into a new buffer, add a new openfile entry. */ /* If we're loading into a new buffer, add a new openfile entry. */
...@@ -534,10 +537,9 @@ int open_file(const char *filename, bool newfie, FILE **f) ...@@ -534,10 +537,9 @@ int open_file(const char *filename, bool newfie, FILE **f)
int fd; int fd;
struct stat fileinfo; struct stat fileinfo;
assert(f != NULL); assert(filename != NULL && f != NULL);
if (filename == NULL || filename[0] == '\0' || if (stat(filename, &fileinfo) == -1) {
stat(filename, &fileinfo) == -1) {
if (newfie) { if (newfie) {
statusbar(_("New File")); statusbar(_("New File"));
return -2; return -2;
......
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