mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-24 03:16:52 +03:00
Removed unneeded st2 var, don't open device files in open_file()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@407 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
544d9b0210
commit
7960dcf919
@ -14,6 +14,8 @@ General
|
||||
- Change open call flags, basically copy joe's way of doing it so
|
||||
a more recent version will actually be included in (un)stable.
|
||||
- Remove useless fstat call.
|
||||
open_file()
|
||||
- Added check for S_ISBLK and S_ISCHR, don't open device files!
|
||||
- nano.c:
|
||||
renumber()
|
||||
- Dont stupidly assign the value of prev->lineno if prev == NULL!
|
||||
|
12
files.c
12
files.c
@ -229,8 +229,14 @@ int open_file(char *filename, int insert, int quiet)
|
||||
statusbar("%s: %s", strerror(errno), filename);
|
||||
return -1;
|
||||
} else { /* File is A-OK */
|
||||
if (S_ISDIR(fileinfo.st_mode)) {
|
||||
statusbar(_("File \"%s\" is a directory"), filename);
|
||||
if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
|
||||
S_ISBLK(fileinfo.st_mode)) {
|
||||
if (S_ISDIR(fileinfo.st_mode))
|
||||
statusbar(_("File \"%s\" is a directory"), filename);
|
||||
else
|
||||
/* Don't open character or block files. Sorry, /dev/sndstat! */
|
||||
statusbar(_("File \"%s\" is a device file"), filename);
|
||||
|
||||
if (!insert)
|
||||
new_file();
|
||||
return -1;
|
||||
@ -303,7 +309,7 @@ int write_file(char *name, int tmp)
|
||||
char buf[PATH_MAX + 1];
|
||||
filestruct *fileptr;
|
||||
int fd, mask = 0, realexists, anyexists;
|
||||
struct stat st, lst, st2;
|
||||
struct stat st, lst;
|
||||
static char *realname = NULL;
|
||||
|
||||
if (!strcmp(name, "")) {
|
||||
|
Loading…
Reference in New Issue
Block a user