From 59a3df564587f03e7058e22d2a5b6c01ac89425e Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 3 Apr 2025 11:34:57 +0200 Subject: [PATCH] xwin: fix NULL parameter in printf arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > ../hw/xwin/winprefs.c:625:9: warning: ā€˜%s’ directive argument is null [-Wformat-overflow=] > 625 | ErrorF("LoadPreferences: %s not found\n", path); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult --- hw/xwin/winprefs.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index 882dac0c6..452473921 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -611,15 +611,12 @@ winIconIsOverride(HICON hicon) /* * Open and parse the XWinrc config file @path. - * If @path is NULL, use the built-in default. + * @path must not be NULL */ static int winPrefsLoadPreferences(const char *path) { - FILE *prefFile = NULL; - - if (path) - prefFile = fopen(path, "r"); + FILE *prefFile = fopen(path, "r"); if (!prefFile) { ErrorF("LoadPreferences: %s not found\n", path); @@ -684,7 +681,6 @@ LoadPreferences(void) if (!parsed) { ErrorF ("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n"); - parsed = winPrefsLoadPreferences(NULL); } /* Setup a DISPLAY environment variable, need to allocate on heap */