diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-05 21:35:33 +0000 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2017-03-01 15:19:18 +0100 |
commit | bd98ba2d7577584e650492bbcb4ea9dd0a3aa809 (patch) | |
tree | d0a360b5d1912895155be9c46ae050d967107493 /nx-X11/programs | |
parent | d981d938dade2967e70322c0bf934efeeb1da716 (diff) | |
download | nx-libs-bd98ba2d7577584e650492bbcb4ea9dd0a3aa809.tar.gz nx-libs-bd98ba2d7577584e650492bbcb4ea9dd0a3aa809.tar.bz2 nx-libs-bd98ba2d7577584e650492bbcb4ea9dd0a3aa809.zip |
For consistency, apply patch from previous commit (630a7c3) to the original Xserver/dix/dixfonts.c file, although the code is undef'ed when NXAGENT_SERVER is defined.
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/dix/dixfonts.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c index bbce105e3..4ac9fa696 100644 --- a/nx-X11/programs/Xserver/dix/dixfonts.c +++ b/nx-X11/programs/Xserver/dix/dixfonts.c @@ -1824,6 +1824,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error) int SetDefaultFontPath(char *path) { + char *temp_path, + *start, + *end; unsigned char *cp, *pp, *nump, @@ -1834,12 +1837,36 @@ SetDefaultFontPath(char *path) size = 0, bad; + /* ensure temp_path contains "built-ins" */ + start = path; + while (1) { + start = strstr(start, "built-ins"); + if (start == NULL) + break; + end = start + strlen("built-ins"); + if ((start == path || start[-1] == ',') && (!*end || *end == ',')) + break; + start = end; + } + if (!start) { + if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "") + == -1) + temp_path = NULL; + } + else { + temp_path = strdup(path); + } + if (!temp_path) + return BadAlloc; + /* get enough for string, plus values -- use up commas */ - len = strlen(path) + 1; + len = strlen(temp_path) + 1; nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len); - if (!newpath) + if (!newpath) { + free(temp_path); return BadAlloc; - pp = (unsigned char *) path; + } + pp = (unsigned char *) temp_path; cp++; while (*pp) { if (*pp == ',') { @@ -1858,6 +1885,7 @@ SetDefaultFontPath(char *path) err = SetFontPathElements(num, newpath, &bad, TRUE); DEALLOCATE_LOCAL(newpath); + free(temp_path); return err; } |