Commit bd98ba2d authored by Mike Gabriel's avatar Mike Gabriel Committed by Mihai Moldovan

For consistency, apply patch from previous commit (630a7c3) to the original…

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.
parent d981d938
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment