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
de57d8b7
Commit
de57d8b7
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
files: don't try to open a negative file descriptor [coverity scan]
parent
dbbe267d
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/files.c
+5
-5
src/files.c
with
5 additions
and
5 deletions
+5
-5
src/files.c
View file @
de57d8b7
...
...
@@ -1604,7 +1604,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
(
method
!=
OVERWRITE
||
openfile
->
mark_set
||
openfile
->
current_stat
->
st_mtime
==
st
.
st_mtime
))
{
int
backup_fd
;
FILE
*
backup_file
;
FILE
*
backup_file
=
NULL
;
char
*
backupname
;
static
struct
timespec
filetime
[
2
];
int
backup_cflags
;
...
...
@@ -1695,11 +1695,11 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
backup_fd
=
open
(
backupname
,
backup_cflags
,
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
);
/* Now we've got a safe file stream. If the previous open()
* call failed, this will return NULL. */
backup_file
=
fdopen
(
backup_fd
,
"wb"
);
if
(
backup_fd
<
0
||
backup_file
==
NULL
)
{
if
(
backup_fd
>=
0
)
backup_file
=
fdopen
(
backup_fd
,
"wb"
);
if
(
backup_file
==
NULL
)
{
statusline
(
HUSH
,
_
(
"Error writing backup file %s: %s"
),
backupname
,
strerror
(
errno
));
free
(
backupname
);
...
...
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