Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
6645351b
Commit
6645351b
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: avoid trying to stat a file that might be NULL [coverity scan]
parent
a5981ab0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/files.c
+8
-5
src/files.c
with
8 additions
and
5 deletions
+8
-5
src/files.c
View file @
6645351b
...
...
@@ -2780,6 +2780,11 @@ void load_history(void)
char
*
nanohist
=
histfilename
();
char
*
legacyhist
=
legacyhistfilename
();
struct
stat
hstat
;
FILE
*
hist
;
/* If no home directory was found, we can't do anything. */
if
(
nanohist
==
NULL
||
legacyhist
==
NULL
)
return
;
/* If there is an old history file, migrate it. */
/* (To be removed in 2018.) */
...
...
@@ -2794,13 +2799,11 @@ void load_history(void)
legacyhist
,
nanohist
);
}
/* Assume do_rcfile() has reported a missing home directory. */
if
(
nanohist
!=
NULL
)
{
FILE
*
hist
=
fopen
(
nanohist
,
"rb"
);
hist
=
fopen
(
nanohist
,
"rb"
);
if
(
hist
==
NULL
)
{
if
(
errno
!=
ENOENT
)
{
/*
D
on't save history when we quit. */
/*
When reading failed, d
on't save history when we quit. */
UNSET
(
HISTORYLOG
);
history_error
(
N_
(
"Error reading %s: %s"
),
nanohist
,
strerror
(
errno
));
...
...
@@ -2827,9 +2830,9 @@ void load_history(void)
fclose
(
hist
);
free
(
line
);
}
free
(
nanohist
);
free
(
legacyhist
);
}
}
/* Write the lines of a history list, starting with the line at head, to
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help