xwin: fix NULL parameter in printf arguments

> ../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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-03 11:34:57 +02:00
parent deee51a5ff
commit 59a3df5645

View File

@ -611,15 +611,12 @@ winIconIsOverride(HICON hicon)
/* /*
* Open and parse the XWinrc config file @path. * Open and parse the XWinrc config file @path.
* If @path is NULL, use the built-in default. * @path must not be NULL
*/ */
static int static int
winPrefsLoadPreferences(const char *path) winPrefsLoadPreferences(const char *path)
{ {
FILE *prefFile = NULL; FILE *prefFile = fopen(path, "r");
if (path)
prefFile = fopen(path, "r");
if (!prefFile) { if (!prefFile) {
ErrorF("LoadPreferences: %s not found\n", path); ErrorF("LoadPreferences: %s not found\n", path);
@ -684,7 +681,6 @@ LoadPreferences(void)
if (!parsed) { if (!parsed) {
ErrorF ErrorF
("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n"); ("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n");
parsed = winPrefsLoadPreferences(NULL);
} }
/* Setup a DISPLAY environment variable, need to allocate on heap */ /* Setup a DISPLAY environment variable, need to allocate on heap */