diff options
author | Akira TAGOH <akira@tagoh.org> | 2014-06-30 15:12:32 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2014-06-30 15:12:32 +0900 |
commit | dab60e4476ada4ad4639599ea24dd012d4a79584 (patch) | |
tree | 1540fdf91033a5bafe655d81bbde8e46edef645f | |
parent | 5004e8e01f5de30ad01904e57ea0eda006ab3a0c (diff) |
Rework for 5004e8e01f5de30ad01904e57ea0eda006ab3a0c
Don't read/write from/to the XDG dirs even if XDG_*_HOME is set
and the home directory is disabled.
-rw-r--r-- | src/fccfg.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/fccfg.c b/src/fccfg.c index 73c45c84..e2555f0c 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -2009,17 +2009,15 @@ FcConfigXdgCacheHome (void) const char *env = getenv ("XDG_CACHE_HOME"); FcChar8 *ret = NULL; + if (!_FcConfigHomeEnabled) + return NULL; if (env) ret = FcStrCopy ((const FcChar8 *)env); else { const FcChar8 *home = FcConfigHome (); - size_t len; + size_t len = home ? strlen ((const char *)home) : 0; - if (!home) - return NULL; - - len = strlen ((const char *)home); ret = malloc (len + 7 + 1); if (ret) { @@ -2038,17 +2036,15 @@ FcConfigXdgConfigHome (void) const char *env = getenv ("XDG_CONFIG_HOME"); FcChar8 *ret = NULL; + if (!_FcConfigHomeEnabled) + return NULL; if (env) ret = FcStrCopy ((const FcChar8 *)env); else { const FcChar8 *home = FcConfigHome (); - size_t len; - - if (!home) - return NULL; + size_t len = home ? strlen ((const char *)home) : 0; - len = strlen ((const char *)home); ret = malloc (len + 8 + 1); if (ret) { @@ -2067,17 +2063,15 @@ FcConfigXdgDataHome (void) const char *env = getenv ("XDG_DATA_HOME"); FcChar8 *ret = NULL; + if (!_FcConfigHomeEnabled) + return NULL; if (env) ret = FcStrCopy ((const FcChar8 *)env); else { const FcChar8 *home = FcConfigHome (); - size_t len; - - if (!home) - return NULL; + size_t len = home ? strlen ((const char *)home) : 0; - len = strlen ((const char *)home); ret = malloc (len + 13 + 1); if (ret) { |