[PATCH libXfont] support relative paths in catalogue:<dir> symlinks

Ademar de Souza Reis Jr ademar at mandriva.com.br
Tue Jul 10 11:32:41 PDT 2007


Relative symlinks are common inside the catalogue directory and
should be supported as well.

  - Ademar

---
 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..2dc3d09 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)
 	{
-- 
1.5.2.2




More information about the xorg mailing list