From 0086b8c2469fbf19a337f38f5431bd77da045332 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 23 Apr 2019 20:08:57 +0200 Subject: Font.c: Avoid duplicate font paths --- nx-X11/programs/Xserver/hw/nxagent/Font.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 89128d4c1..11496938c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -1497,12 +1497,36 @@ void nxagentVerifyDefaultFontPath(void) for (int i = 0; ; i++) { - char *dir = nxagentFontDirs[i]; + int j; + const char *dir = nxagentFontDirs[i]; if (dir == NULL) + { break; + } else - nxagentVerifySingleFontPath(&fontPath, dir); + { + for (j = 0; j <= i; j++) + { + //if (strcmp(nxagentFontDirs[j], dir) == 0) + if (nxagentFontDirs[j] == dir) + { + break; + } + } + + if (j == i) + { + nxagentVerifySingleFontPath(&fontPath, dir); + } +#ifdef TEST + else + { + fprintf(stderr, "%s: Skipping duplicate font dir [%s].\n", __func__, + validateString(dir)); + } +#endif + } } if (*fontPath == '\0') -- cgit v1.2.3