Don't read/write from/to the XDG dirs if the home directory is disabled
This commit is contained in:
parent
274f2181f2
commit
5004e8e01f
18
src/fccfg.c
18
src/fccfg.c
|
@ -2014,8 +2014,12 @@ FcConfigXdgCacheHome (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const FcChar8 *home = FcConfigHome ();
|
const FcChar8 *home = FcConfigHome ();
|
||||||
size_t len = home ? strlen ((const char *)home) : 0;
|
size_t len;
|
||||||
|
|
||||||
|
if (!home)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
len = strlen ((const char *)home);
|
||||||
ret = malloc (len + 7 + 1);
|
ret = malloc (len + 7 + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -2039,8 +2043,12 @@ FcConfigXdgConfigHome (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const FcChar8 *home = FcConfigHome ();
|
const FcChar8 *home = FcConfigHome ();
|
||||||
size_t len = home ? strlen ((const char *)home) : 0;
|
size_t len;
|
||||||
|
|
||||||
|
if (!home)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
len = strlen ((const char *)home);
|
||||||
ret = malloc (len + 8 + 1);
|
ret = malloc (len + 8 + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
@ -2064,8 +2072,12 @@ FcConfigXdgDataHome (void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const FcChar8 *home = FcConfigHome ();
|
const FcChar8 *home = FcConfigHome ();
|
||||||
size_t len = home ? strlen ((const char *)home) : 0;
|
size_t len;
|
||||||
|
|
||||||
|
if (!home)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
len = strlen ((const char *)home);
|
||||||
ret = malloc (len + 13 + 1);
|
ret = malloc (len + 13 + 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
|
|
23
src/fcxml.c
23
src/fcxml.c
|
@ -2051,7 +2051,14 @@ FcParseDir (FcConfigParse *parse)
|
||||||
|
|
||||||
attr = FcConfigGetAttribute (parse, "prefix");
|
attr = FcConfigGetAttribute (parse, "prefix");
|
||||||
if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
|
if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
|
||||||
|
{
|
||||||
prefix = FcConfigXdgDataHome ();
|
prefix = FcConfigXdgDataHome ();
|
||||||
|
/* home directory might be disabled.
|
||||||
|
* simply ignore this element.
|
||||||
|
*/
|
||||||
|
if (!prefix)
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
data = FcStrBufDoneStatic (&parse->pstack->str);
|
data = FcStrBufDoneStatic (&parse->pstack->str);
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -2142,11 +2149,18 @@ static void
|
||||||
FcParseCacheDir (FcConfigParse *parse)
|
FcParseCacheDir (FcConfigParse *parse)
|
||||||
{
|
{
|
||||||
const FcChar8 *attr;
|
const FcChar8 *attr;
|
||||||
FcChar8 *prefix = NULL, *p, *data;
|
FcChar8 *prefix = NULL, *p, *data = NULL;
|
||||||
|
|
||||||
attr = FcConfigGetAttribute (parse, "prefix");
|
attr = FcConfigGetAttribute (parse, "prefix");
|
||||||
if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
|
if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
|
||||||
|
{
|
||||||
prefix = FcConfigXdgCacheHome ();
|
prefix = FcConfigXdgCacheHome ();
|
||||||
|
/* home directory might be disabled.
|
||||||
|
* simply ignore this element.
|
||||||
|
*/
|
||||||
|
if (!prefix)
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
data = FcStrBufDone (&parse->pstack->str);
|
data = FcStrBufDone (&parse->pstack->str);
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
@ -2254,7 +2268,14 @@ FcParseInclude (FcConfigParse *parse)
|
||||||
deprecated = FcTrue;
|
deprecated = FcTrue;
|
||||||
attr = FcConfigGetAttribute (parse, "prefix");
|
attr = FcConfigGetAttribute (parse, "prefix");
|
||||||
if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
|
if (attr && FcStrCmp (attr, (const FcChar8 *)"xdg") == 0)
|
||||||
|
{
|
||||||
prefix = FcConfigXdgConfigHome ();
|
prefix = FcConfigXdgConfigHome ();
|
||||||
|
/* home directory might be disabled.
|
||||||
|
* simply ignore this element.
|
||||||
|
*/
|
||||||
|
if (!prefix)
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
if (prefix)
|
if (prefix)
|
||||||
{
|
{
|
||||||
size_t plen = strlen ((const char *)prefix);
|
size_t plen = strlen ((const char *)prefix);
|
||||||
|
|
Loading…
Reference in New Issue