From db13b93563cbeb0e9a1d0ed40fe969e23efc3d43 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 24 Aug 2021 13:43:02 +0200 Subject: [PATCH] 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. --- src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 824016dd64..4510576811 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -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);