diff options
author | Ademar de Souza Reis Jr <ademar@mandriva.com.br> | 2007-07-30 14:35:01 -0400 |
---|---|---|
committer | Dodji Seketeli <dodji@seketeli.org> | 2007-08-11 23:05:00 +0200 |
commit | 87f50267181887ed9214536608bd2035d2dd70f7 (patch) | |
tree | 4ae1d2009dc15380fe735b6d91dd8e4fe27584d2 | |
parent | 7670d4a2720c61fbc7b989fed14c676f04ac3ad1 (diff) |
Support relative paths in catalogue:<dir> symlinks.
Relative symlinks are common inside the catalogue directory and
should be supported as well.
-rw-r--r-- | src/fontfile/catalogue.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/fontfile/catalogue.c b/src/fontfile/catalogue.c index 812b050..8168ffd 100644 --- a/src/fontfile/catalogue.c +++ b/src/fontfile/catalogue.c @@ -136,6 +136,7 @@ CatalogueRescan (FontPathElementPtr fpe) DIR *dir; struct dirent *entry; int len; + int pathlen; path = fpe->name + strlen(CataloguePrefix); if (stat(path, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode)) @@ -159,6 +160,17 @@ CatalogueRescan (FontPathElementPtr fpe) if (len < 0) continue; + dest[len] = '\0'; + + if (dest[0] != '/') + { + pathlen = strlen(path); + memmove(dest + pathlen + 1, dest, sizeof dest - pathlen - 1); + memcpy(dest, path, pathlen); + memcpy(dest + pathlen, "/", 1); + len += pathlen + 1; + } + attrib = strchr(link, ':'); if (attrib && len + strlen(attrib) < sizeof dest) { |