Verified Commit cde95a3c authored by Beniamino Galvani's avatar Beniamino Galvani Committed by Thomas Haller

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

Fixes: ac5206aa ('2007-11-21')
(cherry picked from commit 581aa981)
(cherry picked from commit bb40de0c)
parent 15156f54
......@@ -1401,6 +1401,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);
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