ifcfg-rh: fail nms_ifcfg_rh_writer_write_connection() without filename/dir

No actual caller should use the API without providing either a filename
or the directory name. I don't think this can actually happen, hence
fail and assert in that case.
This commit is contained in:
Thomas Haller 2021-08-24 13:43:02 +02:00
parent 1fa105eaef
commit db13b93563
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -3279,8 +3279,13 @@ do_write_construct(NMConnection * connection,
return FALSE;
}
ifcfg_name = ifcfg_name_free;
} else
ifcfg_name = "/tmp/ifcfg-dummy";
} else {
g_set_error(error,
NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_FAILED,
"No file name given for storing profile to ifcfg-rh");
g_return_val_if_reached(FALSE);
}
ifcfg = svCreateFile(ifcfg_name);