Respect sysroot option for file path passed to stat
This commit is contained in:
parent
2bd559f75d
commit
d36f977c76
|
@ -142,6 +142,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
|
||||||
FcBool was_valid, was_processed = FcFalse;
|
FcBool was_valid, was_processed = FcFalse;
|
||||||
int i;
|
int i;
|
||||||
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
|
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
|
||||||
|
FcChar8 *rooted_dir = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now scan all of the directories into separate databases
|
* Now scan all of the directories into separate databases
|
||||||
|
@ -157,6 +158,20 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rooted_dir)
|
||||||
|
{
|
||||||
|
FcStrFree(rooted_dir);
|
||||||
|
rooted_dir = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sysroot)
|
||||||
|
{
|
||||||
|
rooted_dir = FcStrPlus(sysroot, dir);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rooted_dir = FcStrCopy(dir);
|
||||||
|
}
|
||||||
|
|
||||||
if (FcStrSetMember (processed_dirs, dir))
|
if (FcStrSetMember (processed_dirs, dir))
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -164,7 +179,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat ((char *) dir, &statb) == -1)
|
if (stat ((char *) rooted_dir, &statb) == -1)
|
||||||
{
|
{
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
|
@ -259,6 +274,11 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
|
||||||
ret += scanDirs (sublist, config, force, really_force, verbose, error_on_no_fonts, changed);
|
ret += scanDirs (sublist, config, force, really_force, verbose, error_on_no_fonts, changed);
|
||||||
FcStrListDone (sublist);
|
FcStrListDone (sublist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rooted_dir)
|
||||||
|
{
|
||||||
|
FcStrFree(rooted_dir);
|
||||||
|
}
|
||||||
if (error_on_no_fonts && !was_processed)
|
if (error_on_no_fonts && !was_processed)
|
||||||
ret++;
|
ret++;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue