SetFontPath: set client->errorValue on failure.
Previously the callers were only setting errorValue on Success, when it's ignored, and leaving it alone on failure, when it's sent to the client. Since SetFontPath takes the ClientPtr, let it set client->errorValue instead of letting the callers continue to get it wrong. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
801162919d
commit
21ceae9002
|
@ -3406,7 +3406,6 @@ ProcSetFontPath(ClientPtr client)
|
||||||
unsigned long nbytes, total;
|
unsigned long nbytes, total;
|
||||||
long nfonts;
|
long nfonts;
|
||||||
int n, result;
|
int n, result;
|
||||||
int error;
|
|
||||||
REQUEST(xSetFontPathReq);
|
REQUEST(xSetFontPathReq);
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
|
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
|
||||||
|
@ -3424,13 +3423,9 @@ ProcSetFontPath(ClientPtr client)
|
||||||
}
|
}
|
||||||
if (total >= 4)
|
if (total >= 4)
|
||||||
return(BadLength);
|
return(BadLength);
|
||||||
result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
|
result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
|
||||||
&error);
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
|
||||||
result = client->noClientException;
|
result = client->noClientException;
|
||||||
client->errorValue = error;
|
|
||||||
}
|
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1789,9 +1789,8 @@ bail:
|
||||||
return FontToXError(err);
|
return FontToXError(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX -- do we need to pass error down to each renderer? */
|
|
||||||
int
|
int
|
||||||
SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
|
SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
|
||||||
{
|
{
|
||||||
int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
|
int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
|
||||||
if (err != Success)
|
if (err != Success)
|
||||||
|
@ -1801,7 +1800,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
|
||||||
if (SetDefaultFontPath(defaultFontPath) != Success)
|
if (SetDefaultFontPath(defaultFontPath) != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
} else {
|
} else {
|
||||||
err = SetFontPathElements(npaths, paths, error, FALSE);
|
int bad;
|
||||||
|
err = SetFontPathElements(npaths, paths, &bad, FALSE);
|
||||||
|
client->errorValue = bad;
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,6 @@ static int dmxProcSetFontPath(ClientPtr client)
|
||||||
unsigned long nbytes, total, n;
|
unsigned long nbytes, total, n;
|
||||||
long nfonts;
|
long nfonts;
|
||||||
int i, result;
|
int i, result;
|
||||||
int error;
|
|
||||||
unsigned char *oldFontPath, *tmpFontPath;
|
unsigned char *oldFontPath, *tmpFontPath;
|
||||||
int nOldPaths;
|
int nOldPaths;
|
||||||
int lenOldPaths;
|
int lenOldPaths;
|
||||||
|
@ -198,22 +197,19 @@ static int dmxProcSetFontPath(ClientPtr client)
|
||||||
oldFontPath = malloc(nOldPaths + lenOldPaths);
|
oldFontPath = malloc(nOldPaths + lenOldPaths);
|
||||||
memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
|
memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
|
||||||
|
|
||||||
result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
|
result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
|
||||||
&error);
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
int error = 0;
|
||||||
for (i = 0; i < dmxNumScreens; i++)
|
for (i = 0; i < dmxNumScreens; i++)
|
||||||
if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
|
if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
int ignoreresult, ignoreerror;
|
|
||||||
|
|
||||||
/* Restore old fontpath in the DMX server */
|
/* Restore old fontpath in the DMX server */
|
||||||
ignoreresult = SetFontPath(client, nOldPaths, oldFontPath,
|
SetFontPath(client, nOldPaths, oldFontPath);
|
||||||
&ignoreerror);
|
client->errorValue = error;
|
||||||
} else {
|
} else {
|
||||||
result = client->noClientException;
|
result = client->noClientException;
|
||||||
client->errorValue = error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +311,6 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
|
||||||
int newnpaths = 0;
|
int newnpaths = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int error;
|
|
||||||
|
|
||||||
dmxLog(dmxError,
|
dmxLog(dmxError,
|
||||||
"These font paths will not be used because the "
|
"These font paths will not be used because the "
|
||||||
|
@ -361,8 +356,7 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp,
|
if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp)) {
|
||||||
&error)) {
|
|
||||||
/* Note that this should never happen since all of the
|
/* Note that this should never happen since all of the
|
||||||
* FPEs were previously valid. */
|
* FPEs were previously valid. */
|
||||||
dmxLog(dmxError, "Cannot reset the default font path.\n");
|
dmxLog(dmxError, "Cannot reset the default font path.\n");
|
||||||
|
|
|
@ -96,8 +96,7 @@ extern _X_EXPORT int ImageText(ClientPtr /*client*/,
|
||||||
|
|
||||||
extern _X_EXPORT int SetFontPath(ClientPtr /*client*/,
|
extern _X_EXPORT int SetFontPath(ClientPtr /*client*/,
|
||||||
int /*npaths*/,
|
int /*npaths*/,
|
||||||
unsigned char * /*paths*/,
|
unsigned char * /*paths*/);
|
||||||
int * /*error*/);
|
|
||||||
|
|
||||||
extern _X_EXPORT int SetDefaultFontPath(char * /*path*/);
|
extern _X_EXPORT int SetDefaultFontPath(char * /*path*/);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue