mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 23:00:19 +01:00
ifcfg-rh: check return value of fdopen()
Reported by coverity:
>>> CID 210222: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a pointer that might be "NULL" "f" when calling
"fseek".
Fixes: ac5206aa9c ('2007-11-21')
(cherry picked from commit 581aa981c2)
This commit is contained in:
parent
144e7e40f0
commit
bb40de0ca0
1 changed files with 7 additions and 0 deletions
|
|
@ -1492,6 +1492,13 @@ svWriteFile (shvarFile *s, int mode, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
f = fdopen (tmpfd, "w");
|
||||
if (!f) {
|
||||
errsv = errno;
|
||||
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errsv),
|
||||
"Internal error writing file '%s': %s",
|
||||
s->fileName, nm_strerror_native (errsv));
|
||||
return FALSE;
|
||||
}
|
||||
fseek (f, 0, SEEK_SET);
|
||||
c_list_for_each (current, &s->lst_head) {
|
||||
const shvarLine *line = c_list_entry (current, shvarLine, lst);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue