diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-05 21:35:33 +0000 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-27 12:25:28 +0100 |
commit | 2ba23b3bcf8f51d12c34582c8e0c51abebad6fda (patch) | |
tree | 58c96d52fb520ec7c2db6ba292db4dd6b928fc98 /nx-X11/programs/Xserver/dix/dixfonts.c | |
parent | ed40c3db1d5d6a58523c49d733678af10515460d (diff) | |
download | nx-libs-2ba23b3bcf8f51d12c34582c8e0c51abebad6fda.tar.gz nx-libs-2ba23b3bcf8f51d12c34582c8e0c51abebad6fda.tar.bz2 nx-libs-2ba23b3bcf8f51d12c34582c8e0c51abebad6fda.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/Xserver/dix/dixfonts.c')
-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; } |