summaryrefslogtreecommitdiff
path: root/fc-cache
diff options
context:
space:
mode:
authorChris McDonald <cjmcdonald@chromium.org>2018-11-19 15:19:19 -0700
committerChris McDonald <cjmcdonald@chromium.org>2018-11-19 15:19:19 -0700
commitd36f977c761ffbb75d5c76278bc14d1c0e74cc7a (patch)
tree5fb2f03ba88660bbdcd3f4bbedb09d992dfb69ec /fc-cache
parent2bd559f75d76b514f789e32c5cc9643fd7c1e9a2 (diff)
Respect sysroot option for file path passed to stat
Diffstat (limited to 'fc-cache')
-rw-r--r--fc-cache/fc-cache.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 87e3020..61dd57d 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -142,6 +142,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
FcBool was_valid, was_processed = FcFalse;
int i;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *rooted_dir = NULL;
/*
* Now scan all of the directories into separate databases
@@ -156,7 +157,21 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
printf ("%s: ", dir);
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 (verbose)
@@ -164,7 +179,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
continue;
}
- if (stat ((char *) dir, &statb) == -1)
+ if (stat ((char *) rooted_dir, &statb) == -1)
{
switch (errno) {
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);
FcStrListDone (sublist);
}
+
+ if (rooted_dir)
+ {
+ FcStrFree(rooted_dir);
+ }
if (error_on_no_fonts && !was_processed)
ret++;
return ret;