mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 02:40:17 +01:00
ifcfg-rh: don't fail creating shvarFile instance
When calling svOpenFileInternal() with @create, we don't care about potential errors reading the file. We shouldn't return NULL in such case, but always create a shvarFile instance.
This commit is contained in:
parent
8687081534
commit
95a76f7263
1 changed files with 4 additions and 2 deletions
|
|
@ -794,7 +794,7 @@ svOpenFileInternal (const char *name, gboolean create, GError **error)
|
|||
int errsv = 0;
|
||||
char *arena;
|
||||
const char *p, *q;
|
||||
GError *local = NULL;
|
||||
gs_free_error GError *local = NULL;
|
||||
nm_auto_close int fd = -1;
|
||||
|
||||
if (create)
|
||||
|
|
@ -824,11 +824,13 @@ svOpenFileInternal (const char *name, gboolean create, GError **error)
|
|||
&arena,
|
||||
NULL,
|
||||
&local) < 0) {
|
||||
if (create)
|
||||
return svFile_new (name);
|
||||
|
||||
g_set_error (error, G_FILE_ERROR,
|
||||
local->domain == G_FILE_ERROR ? local->code : G_FILE_ERROR_FAILED,
|
||||
"Could not read file '%s': %s",
|
||||
name, local->message);
|
||||
g_error_free (local);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue